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

# Disconnect

> Soft-disconnect a connection (status `disconnected`, stamp `disconnectedAt`). Never hard-deletes — preserves the install id and `connectedAt` for audit.



## OpenAPI

````yaml /openapi.json patch /v0/merchantIntegrations/{id}/disconnect
openapi: 3.1.0
info:
  title: Paygentic API
  version: 0.1.0
  description: >
    The Paygentic API provides a comprehensive platform for building and scaling
    monetization infrastructure.


    ## Authentication

    All API requests require authentication using an API key passed in the
    `Authorization` header:

    ```

    Authorization: Bearer YOUR_API_KEY

    ```


    ## Base URL

    All API requests should be made to:

    ```

    https://api.paygentic.io/v0

    ```
  contact:
    name: Paygentic Support
    email: support@paygentic.io
  license:
    name: Proprietary
servers:
  - url: https://api.paygentic.io
    description: Production API
  - url: https://api.sandbox.paygentic.io
    description: Sandbox API
security:
  - BearerAuth: []
tags:
  - name: Customers
    description: >-
      A `Customer` is an entity connected to a `Merchant` via a `Subscription`.
      This represents the merchant-facing perspective of `Consumers` who
      purchase their `Products`.
  - name: Billable Metrics
    description: >-
      A `Billable Metric` defines a measurable quantity tied to a `Product`'s
      consumption. Each metric stores details including its label, an
      explanatory description, and measurement units.
  - name: Grants
    description: >-
      Grants credit a customer's metered entitlement balance. Merchants can
      create grants directly or void existing ones.


      Use `GET /v1/entitlements?customerId={id}` or `GET
      /v1/entitlements?subscriptionId={id}` to find the metered entitlement `id`
      needed for these endpoints.
  - name: Features
    description: >-
      A `Feature` represents a specific capability or functionality provided by
      a `Product`. Features can be metered (usage-based), static (fixed
      allocation), or boolean (enabled/disabled).
  - name: Fees
    description: >-
      A `Fee` defines a recurring or one-time charge tied to a `Product`. Fees
      are linked to prices, and cadence is defined on the Price.
  - name: Plans
    description: >-
      A `Plan` links a collection of `Prices` to a `Product`. It functions as a
      pricing structure document for a particular feature set or service
      offering.
  - name: Prices
    description: >-
      A `Price` determines the monetary value for a single unit of a `Billable
      Metric`. Prices are exclusively grouped within a `Plan`.
  - name: Products
    description: >-
      A `Product` is an offering sold by a `Merchant`. It includes product
      metadata like title, summary, and pricing details. `Plans`, `Prices`, and
      `Subscriptions` are all associated with products.
  - name: Sources
    description: >-
      A `Source` is an external data provider capable of automatically creating
      usage events. Configuration occurs at the plan level, enabling data
      retrieval from third-party platforms such as Stripe to produce billable
      events.
  - name: Subscriptions
    description: >-
      A `Subscription` is a customer's commitment to purchase a `Product`
      following the terms of a `Plan` and its linked `Prices`.
  - name: Users
    description: >-
      A `User` is an entity granted access to an Organization's resources. All
      operations are performed by users.
  - name: Invoices V2
    description: >-
      Invoice V2 operations supporting billing cycles organized by time periods.
      Warning: v0 invoice endpoints are no longer supported.
  - name: Revenue
    description: Revenue data from invoices and payments
  - name: Profitability
    description: Per-customer profitability summaries
  - name: Test Clocks
    description: >-
      Test clocks provide programmable time control to simulate subscription and
      billing scenarios during testing.
  - name: Events
    description: Ingest raw metering events that are processed by the meters service.
  - name: Payments
    description: >-
      Create and manage one-off payments. A payment represents a single charge
      that a merchant wants to collect from a customer.
  - name: Payment Sessions
    description: >-
      Handle payment session lifecycle and processing across various entity
      types including invoices and subscriptions
  - name: Costs
    description: >-
      A Cost represents the operational or infrastructure expense of serving
      customers for a given product. Costs are metered (driven by event-based
      usage) and are tracked in parallel with billable metrics to give merchants
      visibility into both revenue and cost per customer.
  - name: ExternalReferences
    description: >-
      An `ExternalReference` links a Paygentic entity (e.g. an `Item`) to a
      record in an external system such as Salesforce or NetSuite. Multiple
      external records may map to the same Paygentic entity, but each external
      id is the *primary* reference of at most one entity per merchant.
  - name: Items
    description: >-
      An `Item` is the canonical "thing you sell" that external-system mappings
      point at. It is fully decoupled from the billing `Product` and holds no
      pricing/plan/metering, and it is CRM/ERP agnostic — which providers map to
      it lives entirely in its `ExternalReference` rows.
  - name: MerchantIntegrations
    description: >-
      A `MerchantIntegration` records a merchant's connection to an external
      provider. One connection per `(merchant, provider)` — re-connecting
      upserts in place.
  - name: Approvals
    description: Submit, decide, cancel, and read maker-checker approvals.
  - name: Orders
    description: Manage Orders, their line items, and billing schedules.
  - name: Billing Schedules
    description: >-
      Owner-polymorphic billing schedules with intervals and staged invoice
      projections. A BillingSchedule belongs to exactly one Order or one
      Subscription (XOR). Cadence lives on ScheduleIntervals
      (cadence-on-the-line).
paths:
  /v0/merchantIntegrations/{id}/disconnect:
    parameters:
      - name: id
        in: path
        required: true
        description: The unique identifier of the merchant integration
        schema:
          type: string
          pattern: ^mint_[a-zA-Z0-9]+$
    patch:
      tags:
        - MerchantIntegrations
      summary: Disconnect
      description: >-
        Soft-disconnect a connection (status `disconnected`, stamp
        `disconnectedAt`). Never hard-deletes — preserves the install id and
        `connectedAt` for audit.
      operationId: disconnectMerchantIntegration
      responses:
        '200':
          description: Merchant integration disconnected
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantIntegration'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    MerchantIntegration:
      type: object
      description: >-
        A merchant's tenant-level connection to an external provider via
        Ampersand.
      required:
        - id
        - object
        - merchantId
        - provider
        - externalId
        - status
        - capabilities
        - config
        - metadata
        - connectedAt
        - disconnectedAt
        - createdAt
        - updatedAt
      properties:
        id:
          $ref: '#/components/schemas/MerchantIntegrationId'
        object:
          type: string
          enum:
            - merchantIntegration
          default: merchantIntegration
        merchantId:
          $ref: '#/components/schemas/OrganizationId'
        provider:
          $ref: '#/components/schemas/MerchantIntegrationProvider'
        capabilities:
          $ref: '#/components/schemas/MappingCapabilities'
        externalId:
          type: string
          nullable: true
          description: Ampersand installation id.
        status:
          $ref: '#/components/schemas/MerchantIntegrationStatus'
        config:
          type: object
          additionalProperties: true
        metadata:
          type: object
          additionalProperties: true
        connectedAt:
          type: string
          format: date-time
        disconnectedAt:
          type: string
          format: date-time
          nullable: true
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    MerchantIntegrationId:
      type: string
      pattern: ^mint_[a-zA-Z0-9]+$
      description: Unique identifier for a merchant integration
    OrganizationId:
      type: string
      pattern: ^org_[a-zA-Z0-9]+$
      description: Unique identifier for an organization
    MerchantIntegrationProvider:
      type: string
      enum:
        - salesforce
        - netsuite
        - accountsiq
      description: >-
        External provider a merchant can connect at the tenant level. `netsuite`
        and `accountsiq` are returned on reads wherever a connection exists, but
        connecting them is accepted only in local and development environments;
        elsewhere the connect request is refused with 404.
    MappingCapabilities:
      type: object
      required:
        - resolvesItemCodes
        - sendsItemCodes
      additionalProperties: false
      description: >-
        What this provider does with an item's external codes.


        Two independent capabilities, not one direction: the behaviours are not
        alternatives. An integration can resolve an incoming item code *and* be
        sent a selected one on a different path, so a single
        `inbound`/`outbound` value would have to misdescribe it or forbid one of
        its operations.


        A capability that is not declared is unavailable rather than inferred.
        Declaring one does not make a provider connectable — that still requires
        its credentials and connection lifecycle.
      properties:
        resolvesItemCodes:
          type: boolean
          description: >-
            A code arriving from this provider must name exactly one of the
            merchant's items. The lookup key is the code, so several codes may
            point at one item while each code resolves to one — which is why a
            code recorded for this purpose is claimed, and a second item
            claiming it is a conflict.
        sendsItemCodes:
          type: boolean
          description: >-
            A consumer needs one of an item's codes to send to this provider,
            and takes the item's designated one (`isDefault`). Because the
            lookup key is the item, several items may share one code — a chart
            of accounts exists so that many things sold roll into one account.
    MerchantIntegrationStatus:
      type: string
      enum:
        - active
        - disconnected
        - error
      description: >-
        Connection lifecycle state. Live Ampersand health is separate and not
        stored here.
    Error:
      type: object
      required:
        - message
      properties:
        error:
          type: string
          description: >-
            Coarse HTTP error category (e.g. 'bad_request', 'forbidden'). Maps
            to the HTTP status code.
        message:
          type: string
          description: >-
            Human-readable error message. Clients must not parse this field
            programmatically.
        code:
          type: string
          examples:
            - TAX_NOT_ENABLED
            - PAYMENT_SESSION_EXPIRED
          description: >-
            Optional semantic business error code for machine-readable
            discrimination (e.g. 'TAX_NOT_ENABLED'). UPPER_SNAKE_CASE. Clients
            should check this field, not message.
        details:
          type: object
          description: Additional error details
          additionalProperties: true
      example:
        message: The requested resource was not found
        error: not_found
  responses:
    Unauthorized:
      description: Unauthorized - Authentication failed or user does not have permissions
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: Forbidden - Request is understood but refused
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Not Found - The requested resource could not be found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalServerError:
      description: Internal Server Error - Something went wrong on the server side
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: API key authentication

````