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

# Safely retire a credit purchase that never started

> Use the original workspace, credit amount and idempotency key. Atomically retire an absent original intent or return the existing operation unchanged. This endpoint never submits or reconciles a payment. Retry uncertain responses with the same identity; a fresh purchase requires separate explicit approval.

Authentication: workspace API key in `Authorization: Bearer <key>`.

## Errors

| Status | Meaning |
| - | - |
| 400 | The request conflicts with current state or a retained request identity. |
| 401 | The request conflicts with current state or a retained request identity. |
| 403 | The request conflicts with current state or a retained request identity. |
| 409 | The request conflicts with current state or a retained request identity. |
| 503 | A required service is unavailable. Respect Retry-After when present. |


## OpenAPI

````yaml openapi.json POST /api/v2/billing/credit-purchases/recover
openapi: 3.1.1
info:
  title: Deepline API
  version: v2
  description: >-
    Discover typed GTM tools and callable Plays, then execute a tool or start
    and inspect a durable Deepline Play run. Use the MCP endpoint when your
    client supports Model Context Protocol.
  contact:
    name: Deepline support
    email: team@deepline.com
    url: https://deepline.com/contact
servers:
  - url: https://code.deepline.com
    description: Deepline production runtime API
security: []
tags:
  - name: Health
    description: Availability checks.
  - name: Billing
    description: Safe recovery of existing purchase intent.
  - name: Tools
    description: Discover and execute typed provider tools.
  - name: Plays
    description: Discover, start, and inspect durable Play runs.
externalDocs:
  description: API reference
  url: https://deepline.com/docs/api-reference
paths:
  /api/v2/billing/credit-purchases/recover:
    post:
      tags:
        - Billing
      summary: Safely retire a credit purchase that never started
      description: >-
        Use the original workspace, credit amount and idempotency key.
        Atomically retire an absent original intent or return the existing
        operation unchanged. This endpoint never submits or reconciles a
        payment. Retry uncertain responses with the same identity; a fresh
        purchase requires separate explicit approval.
      operationId: recoverCreditPurchase
      parameters:
        - name: Idempotency-Key
          in: header
          required: true
          description: >-
            The original purchase idempotency key; never generate a replacement
            for recovery.
          schema:
            type: string
            minLength: 1
            maxLength: 200
      requestBody:
        required: true
        description: >-
          The original purchase identity; org_id must match the authenticated
          workspace.
        content:
          application/json:
            schema:
              type: object
              required:
                - credits
                - org_id
              properties:
                credits:
                  type: integer
                  minimum: 1
                  maximum: 9007199254740991
                org_id:
                  type: string
                  minLength: 1
      responses:
        '200':
          description: A successful Runtime API response.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      org_id:
                        type: string
                      credits:
                        type: number
                      amount_cents:
                        type: number
                      currency:
                        type: string
                      recovery_disposition:
                        const: retired_before_start
                    required:
                      - org_id
                  operation:
                    type: object
                    properties:
                      id:
                        type: string
                      state:
                        type: string
                      version:
                        type: number
                      next_action:
                        type:
                          - string
                          - 'null'
                    required:
                      - id
                      - state
                      - version
                      - next_action
                  request_id:
                    type: string
                required:
                  - data
                  - operation
                  - request_id
        '400':
          description: >-
            The request conflicts with current state or a retained request
            identity.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: Unauthorized
        '401':
          description: >-
            The request conflicts with current state or a retained request
            identity.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: Unauthorized
        '403':
          description: >-
            The request conflicts with current state or a retained request
            identity.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: Unauthorized
        '409':
          description: >-
            The request conflicts with current state or a retained request
            identity.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: Unauthorized
        '503':
          description: A required service is unavailable. Respect Retry-After when present.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: Unauthorized
          headers:
            Retry-After:
              description: Minimum whole seconds to wait before retrying the request.
              schema:
                type: integer
                minimum: 1
      security:
        - bearerAuth: []
components:
  schemas:
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          oneOf:
            - type: string
              description: Route-specific error message.
            - type: object
              properties:
                code:
                  type: string
                message:
                  type: string
                resolution:
                  type: string
              additionalProperties: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Deepline workspace API key
      description: >-
        Create a workspace API key in the Deepline dashboard before calling
        authenticated endpoints.

````

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