{
  "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"
    }
  },
  "externalDocs": {
    "description": "API reference",
    "url": "https://deepline.com/docs/api-reference"
  },
  "servers": [
    {
      "url": "https://code.deepline.com",
      "description": "Deepline production runtime API"
    }
  ],
  "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."
    }
  ],
  "paths": {
    "/api/v2/health": {
      "get": {
        "operationId": "getRuntimeHealth",
        "tags": [
          "Health"
        ],
        "summary": "Check Runtime API availability",
        "description": "Returns the current Deepline Runtime status. This endpoint does not require authentication.",
        "responses": {
          "200": {
            "description": "A successful Runtime API response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Health"
                }
              }
            }
          }
        },
        "x-deepline-sdk-client-methods": [
          "health"
        ],
        "x-deepline-contract-source-files": [
          "apps/deepline-api/src/app/api/v2/health/route.ts"
        ]
      }
    },
    "/api/v2/tools": {
      "get": {
        "operationId": "listTools",
        "tags": [
          "Tools"
        ],
        "summary": "List callable provider tools",
        "description": "Lists the current callable provider-backed tools. Set compact=false to include each tool input and output schema.",
        "parameters": [
          {
            "name": "categories",
            "in": "query",
            "required": false,
            "description": "Comma-separated tool categories to include.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tags",
            "in": "query",
            "required": false,
            "description": "Comma-separated tool tags to include.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "grep",
            "in": "query",
            "required": false,
            "description": "Literal terms to match against tool metadata.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "compact",
            "in": "query",
            "required": false,
            "description": "Set false to include input and output schemas.",
            "schema": {
              "type": "boolean",
              "default": true
            }
          },
          {
            "name": "grep_mode",
            "in": "query",
            "description": "How to combine literal grep terms.",
            "schema": {
              "enum": [
                "all",
                "any",
                "phrase"
              ],
              "default": "all"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A successful Runtime API response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToolCatalog"
                }
              }
            }
          },
          "400": {
            "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"
                }
              }
            }
          }
        },
        "x-deepline-sdk-client-methods": [
          "listTools"
        ],
        "x-deepline-contract-source-files": [
          "apps/deepline-api/src/app/api/v2/tools/route.ts"
        ]
      }
    },
    "/api/v2/tools/search": {
      "get": {
        "operationId": "searchTools",
        "tags": [
          "Tools"
        ],
        "summary": "Search callable provider tools",
        "description": "Searches the tool catalog by intent and returns ranked typed tool candidates.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "The task or capability to search for. Omit when filtering only by categories or search_terms.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "categories",
            "in": "query",
            "required": false,
            "description": "Comma-separated tool categories to filter.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search_terms",
            "in": "query",
            "required": false,
            "description": "Comma-separated capability terms to rank and filter by, including when q is empty.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum ranked tools to return.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Zero-based offset into the ranked result set.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          },
          {
            "name": "task",
            "in": "query",
            "required": false,
            "description": "Optional. What the caller is trying to accomplish, in one sentence: the input it has and the result it needs, not a restatement of q. Used to rank candidates; up to 300 characters are used.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A successful Runtime API response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToolSearch"
                }
              }
            }
          },
          "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"
                }
              }
            }
          },
          "500": {
            "description": "The request conflicts with current state or a retained request identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Unauthorized"
                }
              }
            }
          }
        },
        "x-deepline-sdk-client-methods": [
          "searchTools"
        ],
        "x-deepline-contract-source-files": [
          "apps/deepline-api/src/app/api/v2/tools/search/route.ts",
          "apps/deepline-api/src/lib/search/search-handler.ts"
        ]
      }
    },
    "/api/v2/search": {
      "get": {
        "operationId": "search",
        "tags": [
          "Tools"
        ],
        "summary": "Search tools, monitor types, plays, and docs",
        "description": "One ranked search across everything Deepline can run, deploy, or explain. Each result carries a kind: tool, monitor_type, prebuilt_play, custom_play, or doc. The workspace’s own (custom) plays are ranked with a small boost. Ranking uses a third-party AI relevance model, which is sent only each custom play’s name and description; play code, inputs, and run data are never shared with it.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "The task or capability to search for. Omit when filtering only by categories or search_terms.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "types",
            "in": "query",
            "required": false,
            "description": "Comma-separated kinds to search: tools or plays (the same: tools, prebuilts and custom), monitors, prebuilts, custom, or docs. Omit to search everything.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "exclude",
            "in": "query",
            "required": false,
            "description": "Comma-separated kinds to leave out, using the same names as types. Applied after types.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "categories",
            "in": "query",
            "required": false,
            "description": "Comma-separated tool categories to filter.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search_terms",
            "in": "query",
            "required": false,
            "description": "Comma-separated capability terms to rank and filter by, including when q is empty.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum ranked results to return.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Zero-based offset into the ranked result set.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          },
          {
            "name": "task",
            "in": "query",
            "required": false,
            "description": "Optional. What the caller is trying to accomplish, in one sentence: the input it has and the result it needs, not a restatement of q. Used to rank candidates; up to 300 characters are used.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A successful Runtime API response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "kind": {
                            "enum": [
                              "tool",
                              "monitor_type",
                              "prebuilt_play",
                              "custom_play"
                            ]
                          },
                          "displayName": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "kind"
                        ]
                      }
                    },
                    "kinds": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "search_ref": {
                      "type": "string"
                    },
                    "count": {
                      "type": "number"
                    },
                    "total": {
                      "type": "number"
                    },
                    "offset": {
                      "type": "number"
                    },
                    "limit": {
                      "type": "number"
                    },
                    "next_offset": {
                      "type": "number"
                    },
                    "total_is_exact": {
                      "type": "boolean"
                    },
                    "may_have_more": {
                      "type": "boolean"
                    },
                    "truncated": {
                      "type": "boolean"
                    },
                    "query": {
                      "type": "string"
                    },
                    "categories": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "search_terms": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "results",
                    "kinds"
                  ]
                }
              }
            }
          },
          "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"
                }
              }
            }
          },
          "500": {
            "description": "The request conflicts with current state or a retained request identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Unauthorized"
                }
              }
            }
          }
        },
        "x-deepline-sdk-client-methods": [
          "search"
        ],
        "x-deepline-contract-source-files": [
          "apps/deepline-api/src/app/api/v2/search/route.ts",
          "apps/deepline-api/src/lib/search/search-handler.ts"
        ]
      }
    },
    "/api/v2/integrations/{toolId}/get": {
      "get": {
        "operationId": "getTool",
        "tags": [
          "Tools"
        ],
        "summary": "Describe one provider-backed tool",
        "description": "Returns the tool input schema, output schema, pricing guidance, and execution metadata. Read this before executing an unfamiliar tool.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "toolId",
            "in": "path",
            "required": true,
            "description": "The toolId 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/ToolDescription"
                }
              }
            }
          },
          "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"
                }
              }
            }
          },
          "404": {
            "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"
                }
              }
            }
          }
        },
        "x-deepline-sdk-client-methods": [
          "getTool"
        ],
        "x-deepline-contract-source-files": [
          "apps/deepline-api/src/app/api/v2/integrations/get/route.ts"
        ]
      }
    },
    "/api/v2/integrations/{toolId}/execute": {
      "post": {
        "operationId": "executeTool",
        "tags": [
          "Tools"
        ],
        "summary": "Execute one provider-backed tool",
        "description": "Executes the named tool with a JSON payload. Authenticate with a Deepline workspace API key and inspect the tool description first. Optional Idempotency-Key binds one workspace-scoped execution to this request and caller identity; repeat the same key and input to recover or replay it. New keys authorize new executions. Keyed async calls require a declared recoverable lifecycle and completion-waiting mode; unsupported launch-only modes return 422 before dispatch.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "toolId",
            "in": "path",
            "required": true,
            "description": "The toolId returned by the related Deepline API call.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional caller-owned execution key. Case-sensitive, 1–200 ASCII letters, digits, period, underscore, colon, or hyphen. Persist before dispatch. Changed input conflicts; expired keys cannot be reused.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Input matching the selected tool input schema.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "payload"
                ],
                "properties": {
                  "payload": {
                    "type": "object",
                    "description": "Input matching the selected tool input schema.",
                    "additionalProperties": true
                  }
                }
              },
              "example": {
                "payload": {
                  "sql": "SELECT company_name, normalized_domain FROM companies WHERE normalized_domain = 'openai.com' LIMIT 1"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A successful Runtime API response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string"
                    },
                    "job_id": {
                      "type": "string",
                      "description": "Execution request identity for billing and diagnostics."
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "toolResponse": {
                      "type": "object",
                      "properties": {
                        "rawV2": {
                          "description": "Complete parsed and scrubbed provider response. Its shape is returned by the tool describe endpoint."
                        },
                        "view": {
                          "enum": [
                            "data",
                            "rawV2"
                          ]
                        },
                        "responseMeta": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": []
                    },
                    "extractedLists": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "extractedValues": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "billing": {
                      "type": "object",
                      "properties": {
                        "credits_charged": {
                          "type": "number"
                        },
                        "cost_usd": {
                          "type": "number"
                        },
                        "pricing_status": {
                          "enum": [
                            "final",
                            "pending"
                          ]
                        },
                        "settlement_status": {
                          "enum": [
                            "pending",
                            "queued",
                            "settled",
                            "released",
                            "requires_recovery"
                          ]
                        },
                        "estimated_credits": {
                          "type": "number"
                        },
                        "estimated_cost_usd": {
                          "type": "number"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "status",
                    "toolResponse"
                  ]
                }
              }
            }
          },
          "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"
                }
              }
            }
          },
          "402": {
            "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"
                }
              }
            }
          },
          "422": {
            "description": "The request conflicts with current state or a retained request identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Unauthorized"
                }
              }
            }
          },
          "429": {
            "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"
                }
              }
            }
          }
        },
        "x-deepline-sdk-client-methods": [
          "executeTool",
          "executeToolRaw"
        ],
        "x-deepline-contract-source-files": [
          "apps/deepline-api/src/app/api/v2/integrations/[toolId]/execute/route.ts",
          "apps/deepline-api/src/app/api/v2/integrations/execute/route.ts"
        ]
      }
    },
    "/api/v2/executions/by-key/{key}": {
      "get": {
        "operationId": "getToolExecutionByKey",
        "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.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "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
                }
              }
            }
          }
        },
        "x-deepline-sdk-client-methods": [
          "executions.getByKey"
        ],
        "x-deepline-contract-source-files": [
          "apps/deepline-api/src/app/api/v2/executions/by-key/[key]/route.ts"
        ]
      }
    },
    "/api/v2/plays/run": {
      "post": {
        "operationId": "startPlayRun",
        "tags": [
          "Plays"
        ],
        "summary": "Start a saved or prebuilt Play run",
        "description": "Starts a durable Play run for a saved or prebuilt play name. Read run.id from the response, then poll getRun until run.status is terminal.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "description": "A saved or prebuilt Play reference with its typed input.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Saved or prebuilt Play reference."
                  },
                  "input": {
                    "type": "object",
                    "description": "Input matching the selected Play schema.",
                    "additionalProperties": true
                  },
                  "revisionId": {
                    "type": "string",
                    "description": "Run a specific saved revision belonging to the named Play."
                  },
                  "force": {
                    "type": "boolean",
                    "description": "Compatibility flag. Active sibling runs are allowed."
                  },
                  "forceToolRefresh": {
                    "type": "boolean",
                    "description": "Bypass cached dataset and tool-call reuse."
                  },
                  "maxCredits": {
                    "type": "number",
                    "exclusiveMinimum": 0,
                    "description": "Per-run Deepline-credit cap. Replaces the Play’s declared maxCreditsPerRun for this run."
                  },
                  "maxConcurrentExternalCalls": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000,
                    "default": 64,
                    "description": "Per-run ceiling on concurrently resident provider-tool executions and direct HTTP calls."
                  },
                  "maxConcurrentRows": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000,
                    "description": "Run-wide default and ceiling for live dataset-map row resolvers."
                  },
                  "waitForCompletionMs": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 15000,
                    "default": 0,
                    "description": "Briefly wait for completion. A timeout returns the existing run, not a new execution."
                  },
                  "terminalStatus": {
                    "enum": [
                      "full"
                    ],
                    "description": "With a completion wait, request the full terminal detail wrapper."
                  }
                }
              },
              "example": {
                "name": "prebuilt/person-linkedin-to-email",
                "input": {
                  "linkedin_url": "https://www.linkedin.com/in/example-person/"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A successful Runtime API response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlayRunPackage"
                },
                "example": {
                  "schemaVersion": 1,
                  "kind": "play_run",
                  "run": {
                    "id": "play/prebuilt/person-linkedin-to-email/run/example",
                    "playName": "person-linkedin-to-email",
                    "status": "running"
                  },
                  "steps": [],
                  "outputs": {},
                  "resultState": "not_returned",
                  "datasets": [],
                  "next": {
                    "inspect": {
                      "kind": "deepline_run_inspect",
                      "runId": "play/prebuilt/person-linkedin-to-email/run/example",
                      "command": "deepline runs get play/prebuilt/person-linkedin-to-email/run/example",
                      "api": {
                        "method": "GET",
                        "path": "/api/v2/runs/play%2Fprebuilt%2Fperson-linkedin-to-email%2Frun%2Fexample"
                      }
                    },
                    "billing": {
                      "kind": "deepline_run_billing",
                      "runId": "play/prebuilt/person-linkedin-to-email/run/example",
                      "command": "deepline billing usage --run-id play/prebuilt/person-linkedin-to-email/run/example",
                      "api": {
                        "method": "GET",
                        "path": "/api/v2/runs/play%2Fprebuilt%2Fperson-linkedin-to-email%2Frun%2Fexample?full=true"
                      }
                    },
                    "logs": {
                      "kind": "deepline_run_logs",
                      "runId": "play/prebuilt/person-linkedin-to-email/run/example",
                      "view": "tail",
                      "limit": 100,
                      "command": "deepline runs logs play/prebuilt/person-linkedin-to-email/run/example --limit 100",
                      "api": {
                        "method": "GET",
                        "path": "/api/v2/runs/play%2Fprebuilt%2Fperson-linkedin-to-email%2Frun%2Fexample/logs?limit=100"
                      }
                    }
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          },
          "402": {
            "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"
                }
              }
            }
          },
          "422": {
            "description": "The request conflicts with current state or a retained request identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Unauthorized"
                }
              }
            }
          },
          "429": {
            "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
                }
              }
            }
          }
        },
        "x-deepline-sdk-client-methods": [
          "startPlayRun",
          "startPlayRunFromBundle",
          "runPlay"
        ],
        "x-deepline-contract-source-files": [
          "apps/deepline-api/src/app/api/v2/plays/run/route.ts"
        ]
      }
    },
    "/api/v2/plays": {
      "get": {
        "operationId": "listPlays",
        "tags": [
          "Plays"
        ],
        "summary": "List and search callable Plays",
        "description": "Lists saved and prebuilt Plays available to the authenticated workspace. Use search or grep to narrow by capability before starting a run.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "summary_only",
            "in": "query",
            "required": false,
            "description": "Load compact metadata without source or revisions. Cost and category requests still load the data they require.",
            "schema": {
              "type": "string",
              "enum": [
                "1"
              ]
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Text to match against callable Play metadata and contracts.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum Plays to return.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A successful Runtime API response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlayCatalog"
                }
              }
            }
          },
          "401": {
            "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"
                }
              }
            }
          }
        },
        "x-deepline-sdk-client-methods": [
          "listPlays",
          "searchPlays"
        ],
        "x-deepline-contract-source-files": [
          "apps/deepline-api/src/app/api/v2/plays/route.ts"
        ]
      }
    },
    "/api/v2/plays/activity": {
      "post": {
        "operationId": "getPlaysActivity",
        "tags": [
          "Plays"
        ],
        "summary": "Count Play runs and delivered Monitor findings by day",
        "description": "Returns bounded, tenant-scoped daily counts from durable Play runs and delivered Monitor receipts. Each bucket reports source coverage; incomplete history is never a zero claim.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Calendar window and grouping.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "timeZone": {
                    "type": "string",
                    "default": "UTC"
                  },
                  "days": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 45,
                    "default": 30
                  },
                  "endDate": {
                    "type": "string",
                    "format": "date"
                  },
                  "groupBy": {
                    "type": "string",
                    "enum": [
                      "kind",
                      "trigger_source"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A successful Runtime API response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "timeZone": {
                      "type": "string"
                    },
                    "groupBy": {
                      "enum": [
                        "kind",
                        "trigger_source"
                      ]
                    },
                    "endDate": {
                      "type": "string"
                    },
                    "asOfAt": {
                      "type": "number"
                    },
                    "buckets": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "key": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "startAt": {
                            "type": "number"
                          },
                          "endAt": {
                            "type": "number"
                          },
                          "groups": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "group": {
                                  "type": "string"
                                },
                                "count": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "group",
                                "count"
                              ]
                            }
                          },
                          "failedPlayRuns": {
                            "type": "number"
                          },
                          "complete": {
                            "type": "object",
                            "properties": {
                              "playRuns": {
                                "type": "boolean"
                              },
                              "monitorDeliveries": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "playRuns",
                              "monitorDeliveries"
                            ]
                          }
                        },
                        "required": [
                          "key",
                          "label",
                          "startAt",
                          "endAt",
                          "groups",
                          "failedPlayRuns",
                          "complete"
                        ]
                      }
                    },
                    "coverage": {
                      "type": "object",
                      "properties": {
                        "playRunsEarliestCompleteAt": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "monitorDeliveriesEarliestCompleteAt": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "monitorDeliveriesCompleteThroughAt": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "projectionPending": {
                          "type": "boolean"
                        },
                        "earliestPendingAt": {
                          "type": [
                            "number",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "playRunsEarliestCompleteAt",
                        "monitorDeliveriesEarliestCompleteAt",
                        "monitorDeliveriesCompleteThroughAt",
                        "projectionPending",
                        "earliestPendingAt"
                      ]
                    }
                  },
                  "required": [
                    "timeZone",
                    "groupBy",
                    "endDate",
                    "buckets",
                    "coverage"
                  ]
                }
              }
            }
          },
          "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"
                }
              }
            }
          },
          "500": {
            "description": "The request conflicts with current state or a retained request identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Unauthorized"
                }
              }
            }
          }
        },
        "x-deepline-sdk-client-methods": [
          "getPlaysActivity"
        ],
        "x-deepline-contract-source-files": [
          "apps/deepline-api/src/app/api/v2/plays/activity/route.ts"
        ]
      }
    },
    "/api/v2/dashboard/runs-history": {
      "get": {
        "operationId": "getRunsHistory",
        "tags": [
          "Plays"
        ],
        "summary": "Search and page workspace run history",
        "description": "Returns runs newest first. Search matches Play/workflow names, run IDs and statuses. Follow nextCursor while hasMore is true, including pages with no matching runs; only a completed search establishes that no matches exist.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Case-insensitive substring, at most 200 characters.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque continuation bound to the same workspace and search.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "Search all, Play or Monitor runs by recorded trigger metadata; requires search.",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "plays",
                "monitors"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum indexed history entries examined in this page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 30,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A successful Runtime API response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "runs": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "runId": {
                            "type": "string"
                          },
                          "workflowId": {
                            "type": "string"
                          },
                          "workflowName": {
                            "type": "string"
                          },
                          "playScope": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "status": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "number"
                          },
                          "updatedAt": {
                            "type": "number"
                          },
                          "callerName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "callerEmail": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "authorName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "authorEmail": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "callerAgent": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "executionMode": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "bindingId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "parentWorkflowName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "outputRowCount": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "hasOutput": {
                            "type": "boolean"
                          },
                          "billingTotalCredits": {
                            "type": "number"
                          },
                          "triggerSource": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "runId",
                          "workflowId",
                          "workflowName",
                          "status",
                          "createdAt",
                          "updatedAt"
                        ]
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "hasMore": {
                      "type": "boolean"
                    },
                    "avatarsByName": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "runs",
                    "nextCursor",
                    "hasMore"
                  ]
                }
              }
            }
          },
          "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"
                }
              }
            }
          },
          "500": {
            "description": "The request conflicts with current state or a retained request identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Unauthorized"
                }
              }
            }
          }
        },
        "x-deepline-sdk-client-methods": [
          "getRunsHistory",
          "runs.history",
          "runs history"
        ],
        "x-deepline-contract-source-files": [
          "apps/deepline-api/src/app/api/v2/dashboard/runs-history/route.ts"
        ]
      }
    },
    "/api/v2/plays/{name}": {
      "get": {
        "operationId": "getPlay",
        "tags": [
          "Plays"
        ],
        "summary": "Describe one callable Play",
        "description": "Returns the selected Play and its callable input and output contract. Read this before starting a Play with unfamiliar input.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "description": "The name returned by the related Deepline API call.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "description": "Set cost to return reference, costEstimate and optional prebuilt observedCost instead of full detail. Compatible with installed Chrome shells.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A successful Runtime API response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "play": {
                      "$ref": "#/components/schemas/Play"
                    },
                    "latestRuns": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "source": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "play",
                    "latestRuns"
                  ]
                }
              }
            }
          },
          "401": {
            "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"
                }
              }
            }
          },
          "500": {
            "description": "The request conflicts with current state or a retained request identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Unauthorized"
                }
              }
            }
          }
        },
        "x-deepline-sdk-client-methods": [
          "getPlay",
          "describePlay"
        ],
        "x-deepline-contract-source-files": [
          "apps/deepline-api/src/app/api/v2/plays/[name]/route.ts"
        ]
      }
    },
    "/api/v2/plays/{name}/cost": {
      "get": {
        "operationId": "getPlayCostEstimate",
        "tags": [
          "Plays"
        ],
        "summary": "Estimate one saved or prebuilt Play",
        "description": "Returns reference and costEstimate using workspace pricing, plus observedCost for prebuilts. Reads only the selected Play and its bounded successful-run cost history. Does not start a run.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "description": "The name returned by the related Deepline API call.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A successful Runtime API response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "reference": {
                      "type": "string"
                    },
                    "costEstimate": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "status": {
                              "const": "available"
                            },
                            "source": {
                              "enum": [
                                "observed",
                                "static"
                              ]
                            },
                            "unit": {
                              "enum": [
                                "row",
                                "run"
                              ]
                            },
                            "lowCredits": {
                              "type": "number"
                            },
                            "highCredits": {
                              "type": "number"
                            },
                            "sampleRunCount": {
                              "type": "number"
                            },
                            "basedOnRunId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "modelVersion": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "status",
                            "source",
                            "unit",
                            "lowCredits",
                            "highCredits",
                            "sampleRunCount",
                            "basedOnRunId",
                            "modelVersion"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "status": {
                              "const": "unavailable"
                            },
                            "reason": {
                              "type": "string"
                            },
                            "message": {
                              "type": "string"
                            },
                            "modelVersion": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "status",
                            "reason",
                            "message",
                            "modelVersion"
                          ]
                        }
                      ]
                    },
                    "observedCost": {
                      "type": "object",
                      "description": "Aggregate observed or typical cost for a prebuilt; does not establish a spending cap.",
                      "additionalProperties": true
                    }
                  },
                  "required": [
                    "reference",
                    "costEstimate"
                  ]
                }
              }
            }
          },
          "401": {
            "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"
                }
              }
            }
          },
          "500": {
            "description": "The request conflicts with current state or a retained request identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Unauthorized"
                }
              }
            }
          }
        },
        "x-deepline-sdk-client-methods": [
          "getPlayCostEstimate",
          "plays cost"
        ],
        "x-deepline-contract-source-files": [
          "apps/deepline-api/src/app/api/v2/plays/[name]/cost/route.ts"
        ]
      }
    },
    "/api/v2/plays/{name}/sheet/history": {
      "get": {
        "operationId": "listPlayRunRowHistory",
        "tags": [
          "Plays"
        ],
        "summary": "Read one page of immutable Play Run row history",
        "description": "Reads retained admitted and terminal row generations for a dataset owned by the requested Play Run in the authenticated workspace. Pass nextCursor as cursor to continue. Coverage explicitly reports legacy, unavailable, or in-progress capture; mutable sheet rows are never presented as historical snapshots.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "description": "The name returned by the related Deepline API call.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "runId",
            "in": "query",
            "required": true,
            "description": "Required Play Run identity owning the dataset.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "tableNamespace",
            "in": "query",
            "required": true,
            "description": "Required dataset table namespace within the Play Run.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size from 1 through 1000; defaults to 200.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "default": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque nextCursor from the preceding history page.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A successful Runtime API response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunRowHistoryPage"
                }
              }
            }
          },
          "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"
                }
              }
            }
          },
          "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
                }
              }
            }
          }
        },
        "x-deepline-sdk-client-methods": [
          "runs.rowHistory",
          "getPlayRunRowHistory"
        ],
        "x-deepline-contract-source-files": [
          "apps/deepline-api/src/app/api/v2/plays/[name]/sheet/history/route.ts"
        ]
      }
    },
    "/api/v2/runs/{runId}": {
      "get": {
        "operationId": "getRun",
        "tags": [
          "Plays"
        ],
        "summary": "Get one Play run status",
        "description": "Returns the canonical status and completed output for one Play run. The additive watchSnapshot=true query returns the bounded no-store snapshot polled by SDK watch.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "description": "The runId returned by the related Deepline API call.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "full",
            "in": "query",
            "description": "true selects the legacy detail wrapper: status and result are top-level, and the compact package is nested under package.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "include",
            "in": "query",
            "description": "Optional comma-separated expansions: nodeStates, runInsights, configuration.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "billing",
            "in": "query",
            "description": "false omits billing enrichment from full or runInsights reads.",
            "schema": {
              "type": "boolean",
              "default": true
            }
          },
          {
            "name": "watchSnapshot",
            "in": "query",
            "description": "true returns the bounded status snapshot used by SDK watch.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A successful Runtime API response.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/PlayRunPackage"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string"
                        },
                        "result": {},
                        "package": {
                          "$ref": "#/components/schemas/PlayRunPackage"
                        }
                      },
                      "required": [
                        "status",
                        "package"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "runId": {
                          "type": "string"
                        },
                        "snapshot": {
                          "type": "object",
                          "description": "Bounded status snapshot for watchSnapshot=true; includes status, progress, and retained log tail.",
                          "additionalProperties": true
                        },
                        "terminalStatus": {
                          "description": "Terminal compact package or full detail wrapper, when requested by the SDK watcher."
                        }
                      },
                      "required": [
                        "runId",
                        "snapshot"
                      ]
                    }
                  ]
                },
                "example": {
                  "schemaVersion": 1,
                  "kind": "play_run",
                  "run": {
                    "id": "play/prebuilt/person-linkedin-to-email/run/example",
                    "playName": "person-linkedin-to-email",
                    "status": "running"
                  },
                  "steps": [],
                  "outputs": {},
                  "resultState": "not_returned",
                  "datasets": [],
                  "next": {
                    "inspect": {
                      "kind": "deepline_run_inspect",
                      "runId": "play/prebuilt/person-linkedin-to-email/run/example",
                      "command": "deepline runs get play/prebuilt/person-linkedin-to-email/run/example",
                      "api": {
                        "method": "GET",
                        "path": "/api/v2/runs/play%2Fprebuilt%2Fperson-linkedin-to-email%2Frun%2Fexample"
                      }
                    },
                    "billing": {
                      "kind": "deepline_run_billing",
                      "runId": "play/prebuilt/person-linkedin-to-email/run/example",
                      "command": "deepline billing usage --run-id play/prebuilt/person-linkedin-to-email/run/example",
                      "api": {
                        "method": "GET",
                        "path": "/api/v2/runs/play%2Fprebuilt%2Fperson-linkedin-to-email%2Frun%2Fexample?full=true"
                      }
                    },
                    "logs": {
                      "kind": "deepline_run_logs",
                      "runId": "play/prebuilt/person-linkedin-to-email/run/example",
                      "view": "tail",
                      "limit": 100,
                      "command": "deepline runs logs play/prebuilt/person-linkedin-to-email/run/example --limit 100",
                      "api": {
                        "method": "GET",
                        "path": "/api/v2/runs/play%2Fprebuilt%2Fperson-linkedin-to-email%2Frun%2Fexample/logs?limit=100"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "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"
                }
              }
            }
          },
          "500": {
            "description": "The request conflicts with current state or a retained request identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Unauthorized"
                }
              }
            }
          }
        },
        "x-deepline-sdk-client-methods": [
          "runs.get",
          "runs.watch",
          "getRunStatus",
          "getPlayStatus"
        ],
        "x-deepline-contract-source-files": [
          "apps/deepline-api/src/app/api/v2/runs/[runId]/route.ts"
        ]
      }
    },
    "/api/v2/runs/{runId}/children": {
      "get": {
        "operationId": "listRunChildren",
        "tags": [
          "Plays"
        ],
        "summary": "List one page of async child Runs",
        "description": "Returns a bounded page of direct child Runs for one authored async launch key. Pass nextCursor as cursor to retrieve the next page.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "description": "The runId returned by the related Deepline API call.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "launchKey",
            "in": "query",
            "required": true,
            "description": "Authored ctx.runPlayAsync launch key.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor returned by the previous page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size from 1 through 50; defaults to 50.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A successful Runtime API response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunChildrenPage"
                }
              }
            }
          },
          "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"
                }
              }
            }
          },
          "500": {
            "description": "The request conflicts with current state or a retained request identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Unauthorized"
                }
              }
            }
          }
        },
        "x-deepline-sdk-client-methods": [
          "runs.children",
          "runs children"
        ],
        "x-deepline-contract-source-files": [
          "apps/deepline-api/src/app/api/v2/runs/[runId]/children/route.ts",
          "apps/deepline-api/src/lib/plays/run-route-handlers.ts"
        ]
      }
    },
    "/api/v2/billing/entitlements": {
      "get": {
        "operationId": "getBillingEntitlements",
        "tags": [
          "Billing"
        ],
        "summary": "Read current workspace provider benefits",
        "description": "Returns retained plan terms and paid provider benefit availability. Execution rechecks admission.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "A successful Runtime API response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "org_id": {
                      "type": "string"
                    },
                    "as_of": {
                      "type": "number"
                    },
                    "plan": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "sku": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "catalog_revision": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "included_credits": {
                          "type": "number"
                        },
                        "interval": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      }
                    },
                    "benefits": {
                      "type": "object",
                      "properties": {
                        "quickenrichUnlimited": {
                          "type": "object",
                          "properties": {
                            "status": {
                              "type": "string"
                            },
                            "value": {
                              "type": "object",
                              "properties": {
                                "enabled": {
                                  "type": "boolean"
                                },
                                "requestsPerMinute": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "enabled",
                                "requestsPerMinute"
                              ]
                            },
                            "expiresAt": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "status",
                            "value"
                          ]
                        },
                        "peopleSearch": {
                          "type": "object",
                          "properties": {
                            "status": {
                              "type": "string"
                            },
                            "value": {
                              "type": "object",
                              "properties": {
                                "enabled": {
                                  "type": "boolean"
                                },
                                "requestsPerMinute": {
                                  "type": "number"
                                },
                                "profilesPerMonth": {
                                  "type": "number"
                                },
                                "overageCreditsPerProfile": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "enabled",
                                "requestsPerMinute",
                                "profilesPerMonth"
                              ]
                            },
                            "expiresAt": {
                              "type": "number"
                            },
                            "usage": {
                              "type": "object",
                              "properties": {
                                "month": {
                                  "type": "string"
                                },
                                "periodStartsAt": {
                                  "type": "number"
                                },
                                "resetsAt": {
                                  "type": "number"
                                },
                                "resetsOn": {
                                  "type": "string"
                                },
                                "limit": {
                                  "type": "number"
                                },
                                "consumed": {
                                  "type": "number"
                                },
                                "remaining": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "month",
                                "limit",
                                "consumed",
                                "remaining"
                              ]
                            }
                          },
                          "required": [
                            "status",
                            "value",
                            "usage"
                          ]
                        },
                        "includedStorage": {
                          "type": "object",
                          "properties": {
                            "status": {
                              "type": "string"
                            },
                            "usage": {
                              "type": "object",
                              "properties": {
                                "limit": {
                                  "type": "number"
                                },
                                "consumed": {
                                  "type": "number"
                                },
                                "remaining": {
                                  "type": "number"
                                },
                                "measuredDay": {
                                  "type": "string"
                                },
                                "overageCharged": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "limit",
                                "consumed",
                                "remaining",
                                "measuredDay",
                                "overageCharged"
                              ]
                            }
                          },
                          "required": [
                            "status",
                            "usage"
                          ]
                        }
                      },
                      "required": []
                    },
                    "effective_limits": {
                      "type": "object",
                      "properties": {
                        "quickenrichUnlimited": {
                          "type": "object",
                          "properties": {
                            "baseline": {
                              "type": "number"
                            },
                            "effective": {
                              "type": "number"
                            },
                            "source": {
                              "enum": [
                                "plan",
                                "override"
                              ]
                            },
                            "override_expires_at": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "baseline",
                            "effective",
                            "source"
                          ]
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "org_id",
                    "as_of",
                    "plan",
                    "benefits",
                    "effective_limits"
                  ]
                }
              }
            }
          },
          "401": {
            "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
                }
              }
            }
          }
        },
        "x-deepline-sdk-client-methods": [
          "billing.entitlements",
          "billing entitlements"
        ],
        "x-deepline-contract-source-files": [
          "apps/deepline-api/src/app/api/v2/billing/entitlements/route.ts"
        ]
      }
    },
    "/api/v2/billing/credit-purchases/recover": {
      "post": {
        "operationId": "recoverCreditPurchase",
        "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.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "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
                }
              }
            }
          }
        },
        "x-deepline-sdk-client-methods": [
          "billing.recoverCreditPurchase",
          "billing top-up-recover"
        ],
        "x-deepline-contract-source-files": [
          "apps/deepline-api/src/app/api/v2/billing/credit-purchases/recover/route.ts"
        ]
      }
    },
    "/api/v2/billing/balance": {
      "get": {
        "operationId": "getBillingBalance",
        "tags": [
          "Billing"
        ],
        "summary": "Get workspace credit balance",
        "description": "Reads the authenticated workspace’s balance without starting work or making a purchase. Responses are private and uncached. A null exposure or spendable amount means unavailable, not zero. Check spendable_balance_status before using spendable_balance_credits.",
        "parameters": [
          {
            "name": "view",
            "in": "query",
            "description": "Set pill for the compact display response; omit for the full balance and exposure breakdown.",
            "schema": {
              "type": "string",
              "enum": [
                "pill"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Full balance, or a compact display response when view=pill.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "org_id": {
                          "type": "string"
                        },
                        "balance": {
                          "type": "number"
                        },
                        "balance_display": {
                          "type": "string"
                        },
                        "rough_usd_balance": {
                          "type": "number"
                        },
                        "posted_balance_credits": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "pending_spend_credits": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "spendable_balance_credits": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "spendable_balance_status": {
                          "type": "string",
                          "enum": [
                            "complete",
                            "unavailable"
                          ]
                        },
                        "spendable_balance_checked_at": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "spendable_balance_message": {
                          "type": "string"
                        },
                        "temporary_hold_credits": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "temporary_hold_credits_truncated": {
                          "type": [
                            "boolean",
                            "null"
                          ]
                        },
                        "rough_usd_temporary_holds": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "estimated_hold_credits": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "incurred_unsettled_credits": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "pending_wallet_debit_credits": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "pending_wallet_refund_credits": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "unpriced_unsettled_reservation_count": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "exposure_status": {
                          "type": "string",
                          "enum": [
                            "complete",
                            "partial",
                            "unavailable"
                          ]
                        },
                        "exposure_message": {
                          "type": "string"
                        },
                        "temporary_hold_message": {
                          "type": "string"
                        },
                        "balance_status": {
                          "type": "string"
                        },
                        "has_payment_method": {
                          "type": "boolean"
                        },
                        "payment_method": {
                          "type": [
                            "object",
                            "null"
                          ],
                          "description": "Saved-card display metadata, or null. Never contains card credentials.",
                          "additionalProperties": true
                        },
                        "recovery": {
                          "type": "object",
                          "description": "Present when funding needs attention. Recovery recommendations require explicit purchase approval.",
                          "additionalProperties": true
                        },
                        "updated_at": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "org_id",
                        "balance",
                        "spendable_balance_credits",
                        "spendable_balance_status",
                        "exposure_status"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "org_id": {
                          "type": "string"
                        },
                        "view": {
                          "const": "pill"
                        },
                        "balance": {
                          "type": "number"
                        },
                        "balance_display": {
                          "type": "string"
                        },
                        "rough_usd_balance": {
                          "type": "number"
                        },
                        "balance_status": {
                          "type": "string"
                        },
                        "updated_at": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "org_id",
                        "view",
                        "balance",
                        "balance_display",
                        "rough_usd_balance",
                        "balance_status",
                        "updated_at"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid workspace authentication.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Unauthorized"
                }
              }
            }
          },
          "500": {
            "description": "Server failure. Retry this read; it does not start new work.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/api/v2/billing/usage": {
      "get": {
        "operationId": "getBillingUsage",
        "tags": [
          "Billing"
        ],
        "summary": "Get usage and recent charges",
        "description": "Reads Deepline usage for the authenticated workspace. Use run_id for one run or request_id for one exact call. Pending holds are not final charges. Recent activity is a bounded view; use the ledger for longer history. Responses are private and uncached.",
        "parameters": [
          {
            "name": "run_id",
            "in": "query",
            "description": "Filter recent charges and include spend for this exact public run ID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "request_id",
            "in": "query",
            "description": "Exact call lookup, at most 200 characters. Cannot be combined with run_id, recent_cursor, or recent_offset. Returns only org_id and recent.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "recent_limit",
            "in": "query",
            "description": "Recent page size; default 10, clamped to 100. Ignored for request_id.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 10
            }
          },
          {
            "name": "recent_offset",
            "in": "query",
            "description": "Zero-based recent activity offset, at most 500. Follow recent.next_offset while recent.has_more is true.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 500,
              "default": 0
            }
          },
          {
            "name": "recent_cursor",
            "in": "query",
            "description": "Legacy cursor input. Prefer recent_offset; cannot be combined with request_id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Usage summary with recent activity, or the exact request lookup.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "org_id": {
                      "type": "string"
                    },
                    "balance": {
                      "type": "number"
                    },
                    "balance_display": {
                      "type": "string"
                    },
                    "rough_usd_balance": {
                      "type": "number"
                    },
                    "balance_updated_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "plan": {
                      "type": "object",
                      "properties": {
                        "public_name": {
                          "type": "string"
                        },
                        "usd_per_credit": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "public_name",
                        "usd_per_credit"
                      ]
                    },
                    "managed_usd_per_email": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "has_payment_method": {
                      "type": "boolean"
                    },
                    "payment_method": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "additionalProperties": true
                    },
                    "usage": {
                      "type": "object",
                      "properties": {
                        "month_spent_credits": {
                          "type": "number"
                        },
                        "rough_usd_spent": {
                          "type": "number"
                        },
                        "last_30_days_usage_credits": {
                          "type": "number"
                        },
                        "rough_usd_last_30_days_usage": {
                          "type": "number"
                        },
                        "temporary_hold_credits": {
                          "type": "number"
                        },
                        "temporary_hold_credits_truncated": {
                          "type": "boolean"
                        },
                        "rough_usd_temporary_holds": {
                          "type": "number"
                        },
                        "period_start_at": {
                          "type": "string"
                        },
                        "period_end_at": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "month_spent_credits",
                        "rough_usd_spent",
                        "last_30_days_usage_credits",
                        "rough_usd_last_30_days_usage",
                        "temporary_hold_credits",
                        "temporary_hold_credits_truncated",
                        "rough_usd_temporary_holds",
                        "period_start_at",
                        "period_end_at"
                      ]
                    },
                    "run": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "run_id": {
                          "type": "string"
                        },
                        "spent_credits": {
                          "type": "number"
                        },
                        "rough_usd_spent": {
                          "type": "number"
                        },
                        "event_count": {
                          "type": "number"
                        }
                      }
                    },
                    "quota": {
                      "type": "object",
                      "properties": {
                        "enabled": {
                          "type": "boolean"
                        },
                        "monthly_credits_limit": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "monthly_rough_usd_limit": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "remaining_credits": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "remaining_rough_usd": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "updated_at": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "enabled",
                        "monthly_credits_limit",
                        "monthly_rough_usd_limit",
                        "remaining_credits",
                        "remaining_rough_usd",
                        "updated_at"
                      ]
                    },
                    "autobill": {
                      "type": "object",
                      "description": "Automatic recharge availability and settings; the fields depend on the workspace’s billing terms.",
                      "additionalProperties": true
                    },
                    "recent": {
                      "type": "object",
                      "properties": {
                        "run_id": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        },
                        "total": {
                          "type": "number"
                        },
                        "total_is_exact": {
                          "type": "boolean",
                          "description": "True only when total covers the complete matching history."
                        },
                        "total_lower_bound": {
                          "type": "number"
                        },
                        "offset": {
                          "type": "number"
                        },
                        "limit": {
                          "type": "number"
                        },
                        "next_offset": {
                          "type": "number"
                        },
                        "next_cursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "has_more": {
                          "type": "boolean"
                        },
                        "incomplete": {
                          "type": "boolean",
                          "description": "True when the available page walk cannot establish complete history."
                        },
                        "entries": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "provider": {
                                "type": "string"
                              },
                              "operation": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              },
                              "request_id": {
                                "type": "string"
                              },
                              "run_id": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "play_run_id": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "workflow_id": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "billing_run_id": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "execution_run_id": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "included_in_run_id": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "billing_scope": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "step_block_id": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "step_alias": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "auth_type": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "user_id": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "api_key_id": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "credits": {
                                "type": "number"
                              },
                              "billing_mode": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "pricing_model": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "pricing_basis": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "pricing_unit_amount": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "outcome": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "policy_id": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "provider_units": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "batch_count": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "total_results": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "delta": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "reason": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "stripe_session_id": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "metadata": {
                                "type": [
                                  "object",
                                  "null"
                                ],
                                "additionalProperties": true
                              },
                              "billing_note": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "charge_state": {
                                "type": "string",
                                "enum": [
                                  "posted",
                                  "temporary_hold",
                                  "hold_release",
                                  "pending",
                                  "free",
                                  "failed"
                                ]
                              },
                              "charge_finality": {
                                "type": "string",
                                "enum": [
                                  "final",
                                  "pending",
                                  "unknown"
                                ]
                              },
                              "rough_usd_cost": {
                                "type": [
                                  "number",
                                  "null"
                                ],
                                "description": "Null for pending charges or unknown finality."
                              },
                              "created_at": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "provider",
                              "operation",
                              "status",
                              "request_id",
                              "run_id",
                              "credits",
                              "charge_state"
                            ]
                          }
                        }
                      },
                      "required": [
                        "run_id",
                        "total",
                        "offset",
                        "limit",
                        "next_offset",
                        "next_cursor",
                        "has_more",
                        "incomplete",
                        "entries"
                      ]
                    }
                  },
                  "required": [
                    "org_id",
                    "recent"
                  ]
                },
                "example": {
                  "org_id": "org_example",
                  "recent": {
                    "run_id": null,
                    "request_id": "request_example",
                    "total": 1,
                    "total_is_exact": true,
                    "total_lower_bound": 1,
                    "offset": 0,
                    "limit": 1,
                    "next_offset": 1,
                    "next_cursor": null,
                    "has_more": false,
                    "incomplete": false,
                    "entries": [
                      {
                        "id": "usage_example",
                        "provider": "free",
                        "operation": "simple_company_search",
                        "status": "completed",
                        "request_id": "request_example",
                        "run_id": null,
                        "credits": 0,
                        "charge_state": "free",
                        "charge_finality": "final",
                        "rough_usd_cost": 0
                      }
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input or incompatible filters. Correct the request before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid workspace authentication.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Unauthorized"
                }
              }
            }
          },
          "404": {
            "description": "The requested resource was not found in the authenticated workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Server failure. Retry this read; it does not start new work.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/api/v2/billing/ledger": {
      "get": {
        "operationId": "getBillingLedger",
        "tags": [
          "Billing"
        ],
        "summary": "List or export the credit ledger",
        "description": "Requires workspace admin access. Reads customer-visible credits and debits across the workspace. JSON is paginated: reuse next_cursor while has_more is true, including when a filtered page is empty. CSV streams the matching history and ignores cursor and limit. Responses are private and uncached.",
        "parameters": [
          {
            "name": "format",
            "in": "query",
            "description": "Omit for a JSON page; csv streams a CSV download.",
            "schema": {
              "type": "string",
              "enum": [
                "csv"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "JSON page size; default 50, clamped to 5000. CSV export ignores the requested page limit.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 5000,
              "default": 50
            }
          },
          {
            "name": "since_at",
            "in": "query",
            "description": "Lower creation-time bound as Unix milliseconds.",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "before_at",
            "in": "query",
            "description": "Upper creation-time bound as Unix milliseconds.",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Opaque next_cursor from the previous JSON page. Preserve all filters. Ignored for CSV.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "run_id",
            "in": "query",
            "description": "Exact public run ID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "operation",
            "in": "query",
            "description": "Exact billed operation name.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One JSON page, or a CSV download when format=csv.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "org_id": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "const": "org"
                        }
                      },
                      "required": [
                        "kind"
                      ]
                    },
                    "entries": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "delta": {
                            "type": "number",
                            "description": "Positive for a credit, negative for a debit."
                          },
                          "reason": {
                            "type": "string"
                          },
                          "provider": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "operation": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "request_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "run_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "billing_stage": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "charge_state": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "billing_mode": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "pricing_model": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "pricing_basis": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "charge_credits": {
                            "type": "number"
                          },
                          "outcome": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "result_count": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "deepline_rough_usd": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "api_key_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "metadata": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "additionalProperties": true
                          },
                          "billing_audit": {
                            "type": "object",
                            "additionalProperties": true
                          },
                          "stripe_session_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "created_at": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "delta",
                          "reason",
                          "provider",
                          "operation",
                          "request_id",
                          "run_id",
                          "billing_stage",
                          "charge_state",
                          "billing_mode",
                          "pricing_model",
                          "pricing_basis",
                          "charge_credits",
                          "outcome",
                          "result_count",
                          "deepline_rough_usd",
                          "api_key_id",
                          "metadata",
                          "billing_audit",
                          "stripe_session_id",
                          "created_at"
                        ]
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "next_before_at": {
                      "type": "null"
                    }
                  },
                  "required": [
                    "org_id",
                    "scope",
                    "entries",
                    "has_more",
                    "next_cursor",
                    "next_before_at"
                  ]
                },
                "example": {
                  "org_id": "org_example",
                  "scope": {
                    "kind": "org"
                  },
                  "entries": [],
                  "has_more": false,
                  "next_cursor": null,
                  "next_before_at": null
                }
              },
              "text/csv": {
                "schema": {
                  "type": "string"
                },
                "example": "created_at,delta_credits,reason,provider,operation,request_id,run_id,billing_stage,charge_state,billing_mode,pricing_model,pricing_basis,charge_credits,outcome,result_count,deepline_rough_usd,api_key_id,stripe_session_id\n"
              }
            }
          },
          "401": {
            "description": "Missing or invalid workspace authentication.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "The authenticated identity lacks access to this resource or operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Server failure. Retry this read; it does not start new work.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    }
  },
  "components": {
    "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."
      }
    },
    "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
              }
            ]
          }
        }
      },
      "Health": {
        "type": "object",
        "required": [
          "status",
          "version",
          "timestamp"
        ],
        "properties": {
          "status": {
            "type": "string",
            "const": "ok"
          },
          "version": {
            "type": "string",
            "const": "v2"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ToolCatalog": {
        "type": "object",
        "properties": {
          "tools": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Tool"
            }
          }
        },
        "additionalProperties": true
      },
      "ToolSearch": {
        "type": "object",
        "properties": {
          "tools": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SearchTool"
            }
          }
        },
        "additionalProperties": true
      },
      "Tool": {
        "type": "object",
        "required": [
          "toolId",
          "provider",
          "operationId",
          "description"
        ],
        "properties": {
          "toolId": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "operationId": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "inputSchema": {
            "type": "object",
            "additionalProperties": true
          },
          "outputSchema": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "MonitorTool": {
        "type": "object",
        "required": [
          "toolId",
          "provider",
          "description",
          "kind",
          "callable"
        ],
        "properties": {
          "toolId": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "monitor_type",
              "monitor_variant_index"
            ]
          },
          "callable": {
            "type": "boolean",
            "const": false
          },
          "payload_schema": {
            "type": "object",
            "additionalProperties": true
          },
          "streams": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "variants": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        },
        "additionalProperties": true
      },
      "ToolDescription": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/Tool"
          },
          {
            "$ref": "#/components/schemas/MonitorTool"
          }
        ]
      },
      "SearchTool": {
        "type": "object",
        "required": [
          "toolId",
          "provider",
          "operation",
          "description"
        ],
        "properties": {
          "toolId": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "operation": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "inputFields": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "additionalProperties": true
      },
      "PlayCatalog": {
        "type": "object",
        "properties": {
          "plays": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Play"
            }
          }
        },
        "additionalProperties": true
      },
      "Play": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "reference": {
            "type": "string"
          },
          "displayName": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "origin": {
            "type": "string"
          },
          "ownerType": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          },
          "inputSchema": {
            "type": [
              "object",
              "null"
            ],
            "description": "The selected Play’s input schema.",
            "additionalProperties": true
          },
          "outputSchema": {
            "type": [
              "object",
              "null"
            ],
            "description": "The selected Play’s output schema.",
            "additionalProperties": true
          },
          "currentRevision": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "liveRevision": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "canEdit": {
            "type": "boolean"
          },
          "canClone": {
            "type": "boolean"
          }
        },
        "required": [
          "name"
        ]
      },
      "PlayRunPackage": {
        "type": "object",
        "required": [
          "schemaVersion",
          "kind",
          "run",
          "steps",
          "outputs",
          "datasets",
          "next"
        ],
        "properties": {
          "schemaVersion": {
            "type": "integer",
            "const": 1
          },
          "kind": {
            "type": "string",
            "const": "play_run"
          },
          "run": {
            "type": "object",
            "required": [
              "id",
              "playName",
              "status"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "playName": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "queued",
                  "running",
                  "waiting",
                  "completed",
                  "failed",
                  "cancelled"
                ]
              },
              "dashboardUrl": {
                "type": "string",
                "format": "uri"
              },
              "runUrl": {
                "type": "string",
                "format": "uri"
              }
            },
            "additionalProperties": true
          },
          "steps": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "outputs": {
            "type": "object",
            "additionalProperties": true
          },
          "datasets": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "next": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "RunChildrenPage": {
        "type": "object",
        "required": [
          "children",
          "nextCursor",
          "hasMore"
        ],
        "properties": {
          "children": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "runId",
                "status"
              ],
              "properties": {
                "runId": {
                  "type": "string"
                },
                "playName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "launchKey": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "status": {
                  "type": "string"
                }
              },
              "additionalProperties": true
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "hasMore": {
            "type": "boolean"
          }
        }
      },
      "RunRowHistoryPage": {
        "type": "object",
        "required": [
          "entries",
          "nextCursor",
          "coverage"
        ],
        "properties": {
          "entries": {
            "type": "array",
            "maxItems": 1000,
            "items": {
              "type": "object",
              "required": [
                "runId",
                "datasetId",
                "rowKey",
                "phase",
                "generation",
                "attemptSeq",
                "rowVersion",
                "inputIndex",
                "inputDigest",
                "status",
                "data",
                "source",
                "recordedAt"
              ],
              "properties": {
                "runId": {
                  "type": "string"
                },
                "datasetId": {
                  "type": "string"
                },
                "rowKey": {
                  "type": "string"
                },
                "phase": {
                  "type": "string",
                  "enum": [
                    "admitted",
                    "terminal"
                  ]
                },
                "generation": {
                  "type": "string",
                  "description": "Immutable admission or terminal generation, including distinct same-run repair versions."
                },
                "attemptSeq": {
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "rowVersion": {
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "inputIndex": {
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "inputDigest": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "pending",
                    "enriched",
                    "failed",
                    "cancelled"
                  ]
                },
                "data": {
                  "type": "object",
                  "additionalProperties": true
                },
                "source": {
                  "type": "object",
                  "additionalProperties": true
                },
                "recordedAt": {
                  "type": "string",
                  "format": "date-time"
                }
              }
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "coverage": {
            "type": "object",
            "required": [
              "complete",
              "expectedRows",
              "captureStartedAt",
              "captureCompletedAt",
              "reason"
            ],
            "properties": {
              "complete": {
                "type": "boolean"
              },
              "expectedRows": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "captureStartedAt": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "captureCompletedAt": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "reason": {
                "type": "string",
                "enum": [
                  "storage_not_expanded",
                  "legacy_or_capture_not_enabled",
                  "capture_in_progress",
                  "complete"
                ]
              }
            }
          }
        }
      }
    }
  }
}
