> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sure.am/llms.txt
> Use this file to discover all available pages before exploring further.

# Revoke a publisher, retaining or discarding imported financial history



## OpenAPI

````yaml /openapi.yaml delete /api/v1/financekit/connections/{id}
openapi: 3.0.3
info:
  title: Sure API
  version: v1
  description: OpenAPI documentation generated from executable request specs.
servers:
  - url: https://app.sure.am
    description: Production
  - url: http://localhost:3000
    description: Local development
security: []
paths:
  /api/v1/financekit/connections/{id}:
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
    delete:
      tags:
        - FinanceKit
      summary: Revoke a publisher, retaining or discarding imported financial history
      parameters:
        - name: disposition
          in: query
          required: false
          schema:
            type: string
            enum:
              - retain
              - discard
          description: >-
            What happens to the data this connection imported. retain (the
            default) keeps every account, balance and transaction. discard
            removes them: accounts FinanceKit created are destroyed, accounts it
            was linked to are emptied of FinanceKit-sourced entries and
            rebalanced, and source identities, balance observations and
            conflicts are deleted. Irreversible, and it removes imported entries
            the family later reconciled, excluded or edited. Supported
            dispositions are advertised by GET /api/v1/financekit/capabilities.
      responses:
        '202':
          description: Publisher revoked, discard of imported history accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FinancekitConnection'
        '204':
          description: Publisher revoked, imported history retained
        '400':
          description: Malformed or unsupported protocol
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FinancekitError'
        '401':
          description: Invalid or missing authentication
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FinancekitError'
        '403':
          description: Insufficient permission or publisher eligibility
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FinancekitError'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FinancekitError'
        '409':
          description: Enrollment, mapping, lineage, generation, or stream conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FinancekitError'
        '413':
          description: Payload or record limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FinancekitError'
        '422':
          description: Invalid typed record or consent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FinancekitError'
        '429':
          description: Rate limited or publisher inbox full
          headers:
            Retry-After:
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FinancekitError'
      security:
        - apiKeyAuth: []
        - oauth2:
            - read_write
components:
  schemas:
    FinancekitConnection:
      type: object
      required:
        - id
        - connection_id
        - publisher_id
        - status
        - generation
        - next_sequence
        - open_conflicts
      properties:
        id:
          type: string
          format: uuid
          pattern: >-
            ^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$
        connection_id:
          type: string
          format: uuid
          pattern: >-
            ^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$
        publisher_id:
          type: string
          format: uuid
          pattern: >-
            ^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$
        status:
          type: string
          enum:
            - pending_mapping
            - active
            - repair_required
            - revoked
        generation:
          type: integer
          minimum: 1
        stream_id:
          allOf:
            - type: string
              format: uuid
              pattern: >-
                ^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$
          nullable: true
        next_sequence:
          type: integer
          minimum: 1
        repair_reason:
          type: string
          nullable: true
        last_device_contact_at:
          allOf:
            - type: string
              format: date-time
          nullable: true
        last_accepted_at:
          allOf:
            - type: string
              format: date-time
          nullable: true
        last_imported_at:
          allOf:
            - type: string
              format: date-time
          nullable: true
        last_downstream_at:
          allOf:
            - type: string
              format: date-time
          nullable: true
        last_captured_at:
          allOf:
            - type: string
              format: date-time
          nullable: true
        open_conflicts:
          type: integer
          minimum: 0
        accounts:
          type: array
          items:
            $ref: '#/components/schemas/FinancekitAccountMapping'
        pagination:
          $ref: '#/components/schemas/Pagination'
        purge_requested_at:
          allOf:
            - type: string
              format: date-time
          nullable: true
        purge_completed_at:
          allOf:
            - type: string
              format: date-time
          nullable: true
        disposition:
          type: string
          enum:
            - retain
            - discard
    FinancekitError:
      type: object
      additionalProperties: false
      required:
        - error
      properties:
        error:
          type: string
    FinancekitAccountMapping:
      type: object
      additionalProperties: false
      required:
        - source_id
        - lineage_id
        - mapping_version
        - name
        - institution_name
        - currency
        - accountable_type
        - subtype
        - ledger_timezone
        - account_id
      properties:
        source_id:
          type: string
          format: uuid
          pattern: >-
            ^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$
        lineage_id:
          type: string
          format: uuid
          pattern: >-
            ^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$
        mapping_version:
          type: integer
          minimum: 1
        name:
          type: string
        institution_name:
          type: string
          nullable: true
        currency:
          type: string
        accountable_type:
          type: string
        subtype:
          type: string
        ledger_timezone:
          type: string
        account_id:
          allOf:
            - type: string
              format: uuid
              pattern: >-
                ^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$
          nullable: true
    Pagination:
      type: object
      required:
        - page
        - per_page
        - total_count
        - total_pages
      properties:
        page:
          type: integer
          minimum: 1
        per_page:
          type: integer
          minimum: 1
        total_count:
          type: integer
          minimum: 0
        total_pages:
          type: integer
          minimum: 0
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      name: X-Api-Key
      in: header
      description: API key for authentication. Generate one from your account settings.
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: /oauth/authorize
          tokenUrl: /oauth/token
          scopes:
            read: Read access
            read_write: Read and write access

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.