> ## 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.

# Recover a tool execution by its idempotency key

> Observe a keyed execution in the authenticated workspace. Completed records include the original response. This lookup does not launch paid work. An unused key returns EXECUTION_NOT_FOUND (404); an expired result returns IDEMPOTENCY_KEY_EXPIRED (410). X-Deepline-Idempotency-Supported: true identifies servers that support this contract, including on a recognized unused-key response.

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

URL-encode path values, including `/` characters inside Play references and run IDs.

## 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. |
| 404 | The request conflicts with current state or a retained request identity. |
| 409 | The request conflicts with current state or a retained request identity. |
| 410 | The request conflicts with current state or a retained request identity. |
| 500 | 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 GET /api/v2/executions/by-key/{key}
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/executions/by-key/{key}:
    get:
      tags:
        - Tools
      summary: Recover a tool execution by its idempotency key
      description: >-
        Observe a keyed execution in the authenticated workspace. Completed
        records include the original response. This lookup does not launch paid
        work. An unused key returns EXECUTION_NOT_FOUND (404); an expired result
        returns IDEMPOTENCY_KEY_EXPIRED (410). X-Deepline-Idempotency-Supported:
        true identifies servers that support this contract, including on a
        recognized unused-key response.
      operationId: getToolExecutionByKey
      parameters:
        - name: key
          in: path
          required: true
          description: The key returned by the related Deepline API call.
          schema:
            type: string
            minLength: 1
      responses:
        '200':
          description: A successful Runtime API response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ToolExecutionLookup'
        '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
        '404':
          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
        '410':
          description: >-
            The request conflicts with current state or a retained request
            identity.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: Unauthorized
        '500':
          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:
    ToolExecutionLookup:
      type: object
      required:
        - executionRecovery
        - toolId
      properties:
        toolId:
          type: string
        requestId:
          type: string
          description: >-
            The original execution request id. Pass this to billing.usageEvent()
            when inspecting the retained execution charge.
        executionRecovery:
          type: object
          required:
            - idempotencyKey
            - state
            - replayed
          properties:
            idempotencyKey:
              type: string
            state:
              type: string
              enum:
                - running
                - completed
                - outcome_unknown
            replayed:
              type: boolean
            expiresAt:
              type: string
              format: date-time
          additionalProperties: true
        response:
          type: object
          description: The retained execution response, including Deepline billing.
          additionalProperties: true
        responseStatus:
          type: integer
          description: >-
            Original execute HTTP status. A retained failed execution remains a
            failure.
      additionalProperties: true
    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.