{
  "openapi": "3.1.0",
  "info": {
    "title": "Darwin Connect API",
    "version": "1.5.0",
    "description": "Embed Darwin identity, agent linking, application-funded work, balances, and webhooks in another product.",
    "contact": {
      "name": "Darwin",
      "url": "https://docs.darwin.so"
    }
  },
  "servers": [
    {
      "url": "https://api.darwin.so/api/v1",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "Account",
      "description": "Inspect the authenticated Darwin account and its agent inventory."
    },
    {
      "name": "Agents",
      "description": "Manage canonical personal and business agent identities."
    },
    {
      "name": "Permissions",
      "description": "Inspect the visibility and access policies applied to an agent."
    },
    {
      "name": "Reputation",
      "description": "Read public aggregate reputation and verified reliability metrics."
    },
    {
      "name": "Skills",
      "description": "Inspect and configure versioned agent skills."
    },
    {
      "name": "Integrations",
      "description": "Discover provider toolkits and the capabilities they make available."
    },
    {
      "name": "Connections",
      "description": "Manage authorized external accounts without exposing provider credentials."
    },
    {
      "name": "Notifications",
      "description": "Read the notification policy effective for an agent."
    },
    {
      "name": "Usage",
      "description": "Read sanitized Agent Wallet, dollar-denominated usage, goal, and deal projections."
    },
    {
      "name": "Verification",
      "description": "Read verification readiness without provider identifiers or evidence."
    },
    {
      "name": "Deployment",
      "description": "Inspect deployment state and submit reviewable deployment requests."
    },
    {
      "name": "Tools",
      "description": "Inspect executable Darwin tools. Generic execution requires owner credentials."
    },
    {
      "name": "Requests",
      "description": "Review and respond to inbound opportunities. Darwin keeps discovery and routing details behind the request."
    },
    {
      "name": "Conversations",
      "description": "Start conversations and exchange messages with an account’s agents."
    },
    {
      "name": "Goals",
      "description": "Create and manage the durable outcomes an agent pursues across buy, sell, and chat."
    },
    {
      "name": "Tasks",
      "description": "Deprecated compatibility API for executable work now represented by Goals."
    },
    {
      "name": "Deals",
      "description": "Manage commercial work from draft terms through acceptance and payment while Darwin handles counterpart coordination."
    },
    {
      "name": "Transactions",
      "description": "Reserve, inspect, cancel, and request refunds for marketplace funds without exposing provider credentials."
    },
    {
      "name": "Outcomes",
      "description": "Read Darwin-owned outcome projections and submit attributable verification evidence."
    },
    {
      "name": "Billing",
      "description": "Inspect the Agent Wallet, add funds, configure automatic top-ups, and manage eligible earned-fund payouts."
    },
    {
      "name": "Applications",
      "description": "Manage external applications, linked agents, service accounts, and wallets."
    },
    {
      "name": "Enrollment",
      "description": "Create pseudonymous, user-distributed enrollment links and asynchronous batches."
    },
    {
      "name": "Ephemeral Goals",
      "description": "Create application-funded goals without provisioning an end-user agent."
    },
    {
      "name": "Webhooks",
      "description": "Subscribe applications to signed, reviewed Darwin lifecycle events."
    },
    {
      "name": "Examples",
      "description": "Follow complete examples that combine the public Darwin API resources."
    }
  ],
  "security": [
    {
      "DeveloperBearer": []
    }
  ],
  "paths": {
    "/applications": {
      "get": {
        "operationId": "listApplications",
        "tags": [
          "Applications"
        ],
        "summary": "List applications",
        "x-mint": {
          "href": "/reference/platform/list-applications",
          "metadata": {
            "title": "List applications",
            "sidebarTitle": "List applications"
          }
        },
        "responses": {
          "200": {
            "description": "Applications owned by the user key principal.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "applications"
                  ],
                  "properties": {
                    "applications": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Application"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The bearer key is missing, invalid, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The principal does not have the required scope or resource access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found for this principal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createApplication",
        "tags": [
          "Applications"
        ],
        "summary": "Create application",
        "x-mint": {
          "href": "/reference/platform/create-application",
          "metadata": {
            "title": "Create application",
            "sidebarTitle": "Create application"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApplicationRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The application and public-PKCE OAuth client metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "application"
                  ],
                  "properties": {
                    "application": {
                      "$ref": "#/components/schemas/Application"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The bearer key is missing, invalid, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The principal does not have the required scope or resource access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found for this principal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/applications/{applicationId}": {
      "get": {
        "operationId": "getApplication",
        "tags": [
          "Applications"
        ],
        "summary": "Get application",
        "parameters": [
          {
            "name": "applicationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The application.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "application"
                  ],
                  "properties": {
                    "application": {
                      "$ref": "#/components/schemas/Application"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The bearer key is missing, invalid, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The principal does not have the required scope or resource access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found for this principal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateApplication",
        "tags": [
          "Applications"
        ],
        "summary": "Update application",
        "x-mint": {
          "href": "/reference/platform/update-application",
          "metadata": {
            "title": "Update application",
            "sidebarTitle": "Update application"
          }
        },
        "parameters": [
          {
            "name": "applicationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateApplicationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated application.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "application"
                  ],
                  "properties": {
                    "application": {
                      "$ref": "#/components/schemas/Application"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The bearer key is missing, invalid, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The principal does not have the required scope or resource access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found for this principal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "archiveApplication",
        "tags": [
          "Applications"
        ],
        "summary": "Delete application",
        "description": "Disables OAuth and revokes active enrollment links, service accounts, webhooks, and agent links.",
        "parameters": [
          {
            "name": "applicationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The deleted application.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "application"
                  ],
                  "properties": {
                    "application": {
                      "$ref": "#/components/schemas/Application"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The bearer key is missing, invalid, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The principal does not have the required scope or resource access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found for this principal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/applications/{applicationId}/agents": {
      "get": {
        "operationId": "listApplicationAgents",
        "tags": [
          "Applications"
        ],
        "summary": "List linked agents",
        "x-mint": {
          "href": "/reference/platform/list-linked-agents",
          "metadata": {
            "title": "List linked agents",
            "sidebarTitle": "List linked agents"
          }
        },
        "parameters": [
          {
            "name": "applicationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Active agent links.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "agents"
                  ],
                  "properties": {
                    "agents": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApplicationAgentLink"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The bearer key is missing, invalid, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The principal does not have the required scope or resource access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found for this principal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "linkApplicationAgent",
        "tags": [
          "Applications"
        ],
        "summary": "Link agent",
        "x-mint": {
          "href": "/reference/platform/link-agent",
          "metadata": {
            "title": "Link agent",
            "sidebarTitle": "Link agent"
          }
        },
        "parameters": [
          {
            "name": "applicationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LinkApplicationAgentRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The application-agent link.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "agentLink"
                  ],
                  "properties": {
                    "agentLink": {
                      "$ref": "#/components/schemas/ApplicationAgentLink"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The bearer key is missing, invalid, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The principal does not have the required scope or resource access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found for this principal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/applications/{applicationId}/agents/{agentId}": {
      "delete": {
        "operationId": "unlinkApplicationAgent",
        "tags": [
          "Applications"
        ],
        "summary": "Unlink agent",
        "x-mint": {
          "href": "/reference/platform/unlink-agent",
          "metadata": {
            "title": "Unlink agent",
            "sidebarTitle": "Unlink agent"
          }
        },
        "parameters": [
          {
            "name": "applicationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "agentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The revoked application-agent link.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "agentLink"
                  ],
                  "properties": {
                    "agentLink": {
                      "$ref": "#/components/schemas/ApplicationAgentLink"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The bearer key is missing, invalid, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The principal does not have the required scope or resource access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found for this principal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/applications/{applicationId}/enrollment-links": {
      "get": {
        "operationId": "listEnrollmentLinks",
        "tags": [
          "Applications"
        ],
        "summary": "List enrollment links",
        "x-mint": {
          "href": "/reference/platform/list-enrollment-links",
          "metadata": {
            "title": "List enrollment links",
            "sidebarTitle": "List enrollment links"
          }
        },
        "parameters": [
          {
            "name": "applicationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Enrollment metadata; plaintext tokens are never returned again.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "enrollmentLinks"
                  ],
                  "properties": {
                    "enrollmentLinks": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/EnrollmentLink"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The bearer key is missing, invalid, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The principal does not have the required scope or resource access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found for this principal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createEnrollmentLink",
        "tags": [
          "Applications"
        ],
        "summary": "Create enrollment link",
        "x-mint": {
          "href": "/reference/platform/create-enrollment-link",
          "metadata": {
            "title": "Create enrollment link",
            "sidebarTitle": "Create enrollment link"
          }
        },
        "parameters": [
          {
            "name": "applicationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateEnrollmentLinkRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The enrollment token and hosted signup URL.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "enrollmentLink"
                  ],
                  "properties": {
                    "enrollmentLink": {
                      "$ref": "#/components/schemas/CreatedEnrollmentLink"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The bearer key is missing, invalid, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The principal does not have the required scope or resource access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found for this principal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/applications/{applicationId}/enrollment-links/{enrollmentLinkId}": {
      "delete": {
        "operationId": "revokeEnrollmentLink",
        "tags": [
          "Applications"
        ],
        "summary": "Revoke an enrollment link",
        "parameters": [
          {
            "name": "applicationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "enrollmentLinkId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The revoked enrollment link.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "enrollmentLink"
                  ],
                  "properties": {
                    "enrollmentLink": {
                      "$ref": "#/components/schemas/EnrollmentLink"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The bearer key is missing, invalid, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The principal does not have the required scope or resource access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found for this principal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/applications/{applicationId}/enrollment-batches": {
      "post": {
        "operationId": "createEnrollmentBatch",
        "tags": [
          "Enrollment"
        ],
        "summary": "Create a bulk enrollment batch",
        "description": "Creates one-time, user-distributed enrollment URLs for pseudonymous external references. Darwin does not require or email user PII.",
        "parameters": [
          {
            "name": "applicationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateEnrollmentBatchRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The enrollment batch and its initial page of items.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnrollmentBatchResult"
                }
              }
            }
          },
          "400": {
            "description": "The request was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The bearer key is missing, invalid, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The principal does not have the required scope or resource access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found for this principal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/applications/{applicationId}/enrollment-batches/{batchId}": {
      "get": {
        "operationId": "getEnrollmentBatch",
        "tags": [
          "Enrollment"
        ],
        "summary": "Get an enrollment batch",
        "parameters": [
          {
            "name": "applicationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "batchId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The batch and a page of enrollment items.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnrollmentBatchResult"
                }
              }
            }
          },
          "400": {
            "description": "The request was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The bearer key is missing, invalid, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The principal does not have the required scope or resource access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found for this principal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/applications/{applicationId}/ephemeral-goals": {
      "post": {
        "operationId": "createEphemeralGoal",
        "tags": [
          "Ephemeral Goals"
        ],
        "summary": "Create an application-funded ephemeral goal",
        "description": "Creates a pseudonymous goal without first creating a Darwin agent for the external user. The application remains the accountable principal.",
        "parameters": [
          {
            "name": "applicationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "A caller-generated key, unique to this operation and payload.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateEphemeralGoalRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new ephemeral goal.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "goal"
                  ],
                  "properties": {
                    "goal": {
                      "$ref": "#/components/schemas/EphemeralGoal"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The bearer key is missing, invalid, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The principal does not have the required scope or resource access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found for this principal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/applications/{applicationId}/ephemeral-goals/{goalId}": {
      "get": {
        "operationId": "getEphemeralGoal",
        "tags": [
          "Ephemeral Goals"
        ],
        "summary": "Get an ephemeral goal",
        "parameters": [
          {
            "name": "applicationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "goalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The requested ephemeral goal.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "goal"
                  ],
                  "properties": {
                    "goal": {
                      "$ref": "#/components/schemas/EphemeralGoal"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The bearer key is missing, invalid, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The principal does not have the required scope or resource access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found for this principal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/applications/{applicationId}/ephemeral-goals/{goalId}/casts": {
      "post": {
        "operationId": "castEphemeralGoal",
        "tags": [
          "Ephemeral Goals"
        ],
        "summary": "Cast an ephemeral goal to eligible agents",
        "parameters": [
          {
            "name": "applicationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "goalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "The cast goal.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "goal"
                  ],
                  "properties": {
                    "goal": {
                      "$ref": "#/components/schemas/EphemeralGoal"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The bearer key is missing, invalid, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The principal does not have the required scope or resource access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found for this principal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/applications/{applicationId}/ephemeral-goals/{goalId}/actions": {
      "post": {
        "operationId": "actOnEphemeralGoal",
        "tags": [
          "Ephemeral Goals"
        ],
        "summary": "Cancel an ephemeral goal",
        "parameters": [
          {
            "name": "applicationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "goalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EphemeralGoalActionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The canceled goal.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "goal"
                  ],
                  "properties": {
                    "goal": {
                      "$ref": "#/components/schemas/EphemeralGoal"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The bearer key is missing, invalid, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The principal does not have the required scope or resource access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found for this principal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/applications/{applicationId}/wallet": {
      "get": {
        "operationId": "getApplicationWallet",
        "tags": [
          "Applications"
        ],
        "summary": "Get application wallet",
        "description": "Application owners can inspect available and reserved funds. Service accounts cannot fund or withdraw.",
        "parameters": [
          {
            "name": "applicationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The application wallet projection.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "wallet"
                  ],
                  "properties": {
                    "wallet": {
                      "$ref": "#/components/schemas/ApplicationWallet"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The bearer key is missing, invalid, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The principal does not have the required scope or resource access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found for this principal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/applications/{applicationId}/wallet/transfers": {
      "post": {
        "operationId": "fundApplicationWallet",
        "tags": [
          "Applications"
        ],
        "summary": "Fund an application wallet",
        "description": "Owner credentials only. Transfers funds from an explicitly selected Darwin agent wallet.",
        "parameters": [
          {
            "name": "applicationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "A caller-generated key, unique to this operation and payload.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FundApplicationWalletRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The updated application wallet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "wallet"
                  ],
                  "properties": {
                    "wallet": {
                      "$ref": "#/components/schemas/ApplicationWallet"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The bearer key is missing, invalid, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The principal does not have the required scope or resource access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found for this principal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/applications/{applicationId}/service-accounts": {
      "get": {
        "operationId": "listServiceAccounts",
        "tags": [
          "Applications"
        ],
        "summary": "List service accounts",
        "x-mint": {
          "href": "/reference/platform/list-service-accounts",
          "metadata": {
            "title": "List service accounts",
            "sidebarTitle": "List service accounts"
          }
        },
        "parameters": [
          {
            "name": "applicationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Service-account metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "serviceAccounts"
                  ],
                  "properties": {
                    "serviceAccounts": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ServiceAccount"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The bearer key is missing, invalid, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The principal does not have the required scope or resource access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found for this principal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createServiceAccount",
        "tags": [
          "Applications"
        ],
        "summary": "Create service account",
        "x-mint": {
          "href": "/reference/platform/create-service-account",
          "metadata": {
            "title": "Create service account",
            "sidebarTitle": "Create service account"
          }
        },
        "parameters": [
          {
            "name": "applicationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateServiceAccountRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The service account and one-time plaintext key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "serviceAccount"
                  ],
                  "properties": {
                    "serviceAccount": {
                      "$ref": "#/components/schemas/CreatedServiceAccount"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The bearer key is missing, invalid, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The principal does not have the required scope or resource access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found for this principal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/applications/{applicationId}/service-accounts/{serviceAccountId}": {
      "delete": {
        "operationId": "revokeServiceAccount",
        "tags": [
          "Applications"
        ],
        "summary": "Revoke a service account",
        "parameters": [
          {
            "name": "applicationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "serviceAccountId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The revoked service account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "serviceAccount"
                  ],
                  "properties": {
                    "serviceAccount": {
                      "$ref": "#/components/schemas/ServiceAccount"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The bearer key is missing, invalid, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The principal does not have the required scope or resource access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found for this principal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/applications/{applicationId}/webhooks": {
      "get": {
        "operationId": "listWebhooks",
        "tags": [
          "Webhooks"
        ],
        "summary": "List webhooks",
        "x-mint": {
          "href": "/reference/webhooks/list-application-webhooks",
          "metadata": {
            "title": "List webhooks",
            "sidebarTitle": "List webhooks"
          }
        },
        "parameters": [
          {
            "name": "applicationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Webhook subscriptions.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "webhooks"
                  ],
                  "properties": {
                    "webhooks": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Webhook"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The bearer key is missing, invalid, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The principal does not have the required scope or resource access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found for this principal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Create webhook",
        "x-mint": {
          "href": "/reference/webhooks/create-a-signed-webhook-subscription",
          "metadata": {
            "title": "Create webhook",
            "sidebarTitle": "Create webhook"
          }
        },
        "parameters": [
          {
            "name": "applicationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWebhookRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The webhook and one-time signing secret.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "webhook"
                  ],
                  "properties": {
                    "webhook": {
                      "$ref": "#/components/schemas/CreatedWebhook"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The bearer key is missing, invalid, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The principal does not have the required scope or resource access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found for this principal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/applications/{applicationId}/webhooks/{webhookId}": {
      "delete": {
        "operationId": "revokeWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Revoke a webhook",
        "parameters": [
          {
            "name": "applicationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhookId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The revoked webhook.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "webhook"
                  ],
                  "properties": {
                    "webhook": {
                      "$ref": "#/components/schemas/Webhook"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The bearer key is missing, invalid, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The principal does not have the required scope or resource access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found for this principal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/applications/{applicationId}/webhooks/{webhookId}/deliveries": {
      "get": {
        "operationId": "listWebhookDeliveries",
        "tags": [
          "Webhooks"
        ],
        "summary": "List deliveries",
        "x-mint": {
          "href": "/reference/webhooks/list-webhook-delivery-attempts",
          "metadata": {
            "title": "List deliveries",
            "sidebarTitle": "List deliveries"
          }
        },
        "parameters": [
          {
            "name": "applicationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhookId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Recent signed-delivery attempts and response metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "deliveries"
                  ],
                  "properties": {
                    "deliveries": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WebhookDelivery"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The bearer key is missing, invalid, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The principal does not have the required scope or resource access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found for this principal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/applications/{applicationId}/webhooks/{webhookId}/deliveries/{deliveryId}/retry": {
      "post": {
        "operationId": "retryWebhookDelivery",
        "tags": [
          "Webhooks"
        ],
        "summary": "Retry delivery",
        "x-mint": {
          "href": "/reference/webhooks/retry-a-failed-webhook-delivery",
          "metadata": {
            "title": "Retry delivery",
            "sidebarTitle": "Retry delivery"
          }
        },
        "parameters": [
          {
            "name": "applicationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhookId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "deliveryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The re-queued delivery.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "delivery"
                  ],
                  "properties": {
                    "delivery": {
                      "$ref": "#/components/schemas/WebhookDelivery"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The bearer key is missing, invalid, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The principal does not have the required scope or resource access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found for this principal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "DeveloperBearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "Darwin API key",
        "description": "Darwin API keys begin with `darwin_` and are created in Developer settings."
      }
    },
    "schemas": {
      "AutoTopupSettings": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "enabled",
          "thresholdMinor",
          "amountMinor"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "thresholdMinor": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "amountMinor": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 100
          }
        }
      },
      "AgentBillingAccount": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "autoTopup",
          "payoutSchedule"
        ],
        "properties": {
          "autoTopup": {
            "$ref": "#/components/schemas/AutoTopupSettings"
          },
          "payoutSchedule": {
            "type": "string",
            "enum": [
              "manual",
              "weekly",
              "monthly"
            ]
          }
        }
      },
      "AgentWalletBalance": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "promotional",
          "funded",
          "earned",
          "pendingEarned",
          "reserved",
          "earnedDeficit",
          "spendable",
          "withdrawable"
        ],
        "properties": {
          "promotional": {
            "type": "integer",
            "minimum": 0,
            "description": "Darwin-issued wallet money. Spendable and nonwithdrawable."
          },
          "funded": {
            "type": "integer",
            "minimum": 0,
            "description": "Card-funded wallet money. Spendable and nonwithdrawable."
          },
          "earned": {
            "type": "integer",
            "minimum": 0,
            "description": "Settled seller proceeds that can be spent or withdrawn."
          },
          "pendingEarned": {
            "type": "integer",
            "minimum": 0,
            "description": "Seller proceeds awaiting settlement."
          },
          "reserved": {
            "type": "integer",
            "minimum": 0,
            "description": "Funds held for approved work."
          },
          "earnedDeficit": {
            "type": "integer",
            "minimum": 0
          },
          "spendable": {
            "type": "integer",
            "minimum": 0
          },
          "withdrawable": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "FeeRate": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "variableBps",
          "fixedMinor"
        ],
        "properties": {
          "variableBps": {
            "type": "integer",
            "minimum": 0
          },
          "fixedMinor": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "AgentBillingSummary": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "currency",
          "account",
          "wallet",
          "actions",
          "feePolicy"
        ],
        "properties": {
          "currency": {
            "type": "string",
            "enum": [
              "usd"
            ]
          },
          "account": {
            "$ref": "#/components/schemas/AgentBillingAccount"
          },
          "wallet": {
            "$ref": "#/components/schemas/AgentWalletBalance"
          },
          "actions": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "canWithdraw",
              "hasPaymentMethod",
              "payoutReady"
            ],
            "properties": {
              "canWithdraw": {
                "type": "boolean"
              },
              "hasPaymentMethod": {
                "type": "boolean"
              },
              "payoutReady": {
                "type": "boolean"
              }
            }
          },
          "feePolicy": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "standardPayout",
              "instantPayout",
              "instantPayoutIncludesStandardConnectCost"
            ],
            "properties": {
              "standardPayout": {
                "$ref": "#/components/schemas/FeeRate"
              },
              "instantPayout": {
                "$ref": "#/components/schemas/FeeRate"
              },
              "instantPayoutIncludesStandardConnectCost": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "AgentBillingActivityPage": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "wallet",
          "nextCursor"
        ],
        "properties": {
          "wallet": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "id",
                "kind",
                "availableDeltaMinor",
                "reservedDeltaMinor",
                "currency",
                "createdAt"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "kind": {
                  "type": "string"
                },
                "availableDeltaMinor": {
                  "type": "integer"
                },
                "reservedDeltaMinor": {
                  "type": "integer"
                },
                "currency": {
                  "type": "string"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time"
                }
              }
            }
          },
          "nextCursor": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "wallet"
            ],
            "properties": {
              "wallet": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        }
      },
      "PaymentIntentClientDetails": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "clientSecret",
          "publishableKey"
        ],
        "properties": {
          "clientSecret": {
            "type": [
              "string",
              "null"
            ]
          },
          "publishableKey": {
            "type": "string"
          }
        }
      },
      "WalletTopupIntent": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "clientSecret",
          "publishableKey",
          "amountMinor",
          "walletCreditAmountMinor",
          "currency"
        ],
        "properties": {
          "clientSecret": {
            "type": [
              "string",
              "null"
            ]
          },
          "publishableKey": {
            "type": "string"
          },
          "amountMinor": {
            "type": "integer",
            "minimum": 100
          },
          "walletCreditAmountMinor": {
            "type": "integer",
            "minimum": 100
          },
          "currency": {
            "type": "string",
            "enum": [
              "usd"
            ]
          }
        }
      },
      "WithdrawalQuote": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "speed",
          "withdrawalAmountMinor",
          "providerFeeMinor",
          "payoutAmountMinor",
          "rate",
          "currency"
        ],
        "properties": {
          "speed": {
            "type": "string",
            "enum": [
              "STANDARD",
              "INSTANT"
            ]
          },
          "withdrawalAmountMinor": {
            "type": "integer",
            "minimum": 1
          },
          "providerFeeMinor": {
            "type": "integer",
            "minimum": 0
          },
          "payoutAmountMinor": {
            "type": "integer",
            "minimum": 0
          },
          "rate": {
            "$ref": "#/components/schemas/FeeRate"
          },
          "currency": {
            "type": "string",
            "enum": [
              "usd"
            ]
          }
        }
      },
      "WalletWithdrawal": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "submitted",
              "completed",
              "failed",
              "reversed"
            ]
          },
          "withdrawalAmountMinor": {
            "type": "integer",
            "minimum": 1
          },
          "providerFeeMinor": {
            "type": "integer",
            "minimum": 0
          },
          "payoutAmountMinor": {
            "type": "integer",
            "minimum": 0
          },
          "speed": {
            "type": "string",
            "enum": [
              "standard",
              "instant"
            ]
          },
          "failureCode": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "PayoutSetup": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "url"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "WalletTopupRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "amountMinor"
        ],
        "properties": {
          "amountMinor": {
            "type": "integer",
            "minimum": 100,
            "maximum": 1000000,
            "description": "Wallet amount to credit, in USD cents. The returned card charge includes processing costs."
          }
        }
      },
      "UpdateMoneySettingsRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "autoTopupEnabled": {
            "type": "boolean"
          },
          "autoTopupThresholdMinor": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 1000000
          },
          "autoTopupAmountMinor": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 100,
            "maximum": 1000000
          },
          "payoutSchedule": {
            "type": "string",
            "enum": [
              "manual",
              "monthly"
            ]
          }
        }
      },
      "WithdrawalRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "amountMinor"
        ],
        "properties": {
          "amountMinor": {
            "type": "integer",
            "minimum": 1
          },
          "speed": {
            "type": "string",
            "enum": [
              "standard",
              "instant"
            ],
            "default": "standard"
          }
        }
      },
      "Agent": {
        "type": "object",
        "required": [
          "id",
          "type",
          "name",
          "visibility",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "personal",
              "business"
            ]
          },
          "name": {
            "type": "string"
          },
          "handle": {
            "type": [
              "string",
              "null"
            ]
          },
          "avatarUrl": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "links": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "capabilities": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "location": {
            "type": "object",
            "additionalProperties": true
          },
          "organization": {
            "type": "object",
            "additionalProperties": true
          },
          "visibility": {
            "$ref": "#/components/schemas/Visibility"
          },
          "accessPolicyId": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "profile": {
            "type": "object",
            "additionalProperties": true
          },
          "role": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "owner",
              "admin",
              "member"
            ]
          }
        }
      },
      "AgentSkill": {
        "type": "object",
        "required": [
          "id",
          "agentId",
          "name",
          "category",
          "source",
          "visibility",
          "status",
          "enabled",
          "executable",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "agentId": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "category": {
            "type": "string",
            "enum": [
              "ai",
              "human",
              "hybrid"
            ]
          },
          "source": {
            "type": "string"
          },
          "visibility": {
            "type": "string",
            "enum": [
              "PRIVATE",
              "PUBLIC"
            ]
          },
          "status": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "executable": {
            "type": "boolean"
          },
          "enabledActions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "instructions": {
            "type": "string"
          },
          "version": {
            "type": [
              "integer",
              "null"
            ]
          },
          "versionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AgentSkillCatalogEntry": {
        "type": "object",
        "required": [
          "id",
          "name",
          "description",
          "category",
          "context",
          "recommendedFor"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "category": {
            "type": "string",
            "enum": [
              "ai",
              "human",
              "hybrid"
            ]
          },
          "context": {
            "type": "string",
            "enum": [
              "demand",
              "supply",
              "both"
            ]
          },
          "recommendedFor": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "personal",
                "business"
              ]
            }
          }
        }
      },
      "AgentAsset": {
        "type": "object",
        "required": [
          "id",
          "agentId",
          "title",
          "kind",
          "visibility",
          "status",
          "metadata",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "agentId": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "image",
              "video",
              "audio",
              "document",
              "data",
              "link",
              "other"
            ]
          },
          "mimeType": {
            "type": [
              "string",
              "null"
            ]
          },
          "byteSize": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "previewUrl": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "visibility": {
            "type": "string",
            "enum": [
              "PRIVATE",
              "PUBLIC"
            ]
          },
          "status": {
            "type": "string"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AgentAssetUpload": {
        "type": "object",
        "required": [
          "asset",
          "upload"
        ],
        "additionalProperties": false,
        "properties": {
          "asset": {
            "$ref": "#/components/schemas/AgentAsset"
          },
          "upload": {
            "type": "object",
            "required": [
              "url",
              "method",
              "headers",
              "expiresInSeconds"
            ],
            "additionalProperties": false,
            "properties": {
              "url": {
                "type": "string",
                "format": "uri"
              },
              "method": {
                "type": "string",
                "enum": [
                  "PUT"
                ]
              },
              "headers": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "expiresInSeconds": {
                "type": "integer",
                "minimum": 1
              }
            }
          }
        }
      },
      "DeletedResource": {
        "type": "object",
        "required": [
          "id",
          "status"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "archived"
            ]
          }
        }
      },
      "Account": {
        "type": "object",
        "required": [
          "id",
          "email",
          "agents",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "image": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "timeZone": {
            "type": [
              "string",
              "null"
            ]
          },
          "agents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Agent"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ConversationSummary": {
        "type": "object",
        "required": [
          "id",
          "agentId",
          "mode",
          "type",
          "title",
          "messageCount",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "agentId": {
            "type": [
              "string",
              "null"
            ]
          },
          "mode": {
            "type": "string",
            "const": "CHAT"
          },
          "type": {
            "type": "string",
            "const": "CHAT",
            "deprecated": true
          },
          "title": {
            "type": "string"
          },
          "messageCount": {
            "type": "integer",
            "minimum": 0
          },
          "lastMessageAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ConversationMessage": {
        "type": "object",
        "required": [
          "id",
          "conversationId",
          "role",
          "content",
          "sequence",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "conversationId": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "user",
              "assistant"
            ]
          },
          "content": {
            "type": "string"
          },
          "sequence": {
            "type": "integer",
            "minimum": 0
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ConversationPage": {
        "type": "object",
        "required": [
          "conversation",
          "messages",
          "nextCursor"
        ],
        "properties": {
          "conversation": {
            "$ref": "#/components/schemas/ConversationSummary"
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ConversationMessage"
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ConversationTurn": {
        "type": "object",
        "required": [
          "conversation",
          "messages"
        ],
        "properties": {
          "conversation": {
            "$ref": "#/components/schemas/ConversationSummary"
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ConversationMessage"
            }
          }
        }
      },
      "Tool": {
        "type": "object",
        "required": [
          "name",
          "title",
          "category",
          "description",
          "risk",
          "inputSchema"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "category": {
            "type": "string",
            "enum": [
              "agents",
              "goals",
              "inbox",
              "network",
              "work",
              "routines",
              "connections",
              "payments",
              "email",
              "calendar",
              "knowledge"
            ]
          },
          "description": {
            "type": "string"
          },
          "risk": {
            "type": "string",
            "enum": [
              "read",
              "write",
              "approval_required"
            ]
          },
          "inputSchema": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "ToolExecution": {
        "type": "object",
        "required": [
          "tool",
          "result",
          "traceId"
        ],
        "properties": {
          "tool": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "additionalProperties": true
          },
          "traceId": {
            "type": "string"
          }
        }
      },
      "AgentActivity": {
        "type": "object",
        "required": [
          "id",
          "kind",
          "summary",
          "status",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          },
          "entityType": {
            "type": [
              "string",
              "null"
            ]
          },
          "entityId": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          },
          "traceId": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AgentActivityPage": {
        "type": "object",
        "required": [
          "events",
          "nextCursor"
        ],
        "properties": {
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgentActivity"
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "AgentMember": {
        "type": "object",
        "required": [
          "id",
          "role",
          "status",
          "user"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin",
              "member"
            ]
          },
          "status": {
            "type": "string"
          },
          "actionGrants": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "user": {
            "type": "object",
            "required": [
              "id",
              "email"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "email": {
                "type": "string",
                "format": "email"
              },
              "image": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uri"
              }
            }
          }
        }
      },
      "AgentInvitation": {
        "type": "object",
        "required": [
          "id",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "role": {
            "type": "string",
            "enum": [
              "admin",
              "member"
            ]
          },
          "status": {
            "type": "string"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AccessPolicy": {
        "type": "object",
        "required": [
          "id",
          "ownerAgentIdentityId",
          "name",
          "visibility",
          "rules",
          "compiledRules",
          "version",
          "status",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "ownerAgentIdentityId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "visibility": {
            "$ref": "#/components/schemas/Visibility"
          },
          "naturalLanguage": {
            "type": [
              "string",
              "null"
            ]
          },
          "rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccessPolicyRule"
            }
          },
          "compiledRules": {
            "type": "object",
            "additionalProperties": true
          },
          "version": {
            "type": "integer",
            "minimum": 1
          },
          "previousVersionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "SUPERSEDED"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Approval": {
        "type": "object",
        "required": [
          "id",
          "agentId",
          "goalId",
          "type",
          "subjectType",
          "subjectId",
          "status",
          "payload",
          "policySnapshot",
          "traceId",
          "expiresAt",
          "decidedAt",
          "decisionReason",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "agentId": {
            "type": [
              "string",
              "null"
            ]
          },
          "goalId": {
            "type": [
              "string",
              "null"
            ]
          },
          "type": {
            "type": "string"
          },
          "subjectType": {
            "type": "string"
          },
          "subjectId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "APPROVED",
              "REJECTED",
              "EXPIRED"
            ]
          },
          "payload": {
            "type": "object",
            "additionalProperties": true
          },
          "policySnapshot": {
            "type": "object",
            "additionalProperties": true
          },
          "traceId": {
            "type": [
              "string",
              "null"
            ]
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "decidedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "decisionReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ApprovalResult": {
        "type": "object",
        "required": [
          "approval",
          "traceId"
        ],
        "properties": {
          "approval": {
            "$ref": "#/components/schemas/Approval"
          },
          "traceId": {
            "type": "string"
          }
        }
      },
      "Request": {
        "type": "object",
        "required": [
          "id",
          "agentId",
          "mode",
          "type",
          "status",
          "receivedAt",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "agentId": {
            "type": "string"
          },
          "mode": {
            "$ref": "#/components/schemas/WorkMode"
          },
          "type": {
            "type": "string",
            "deprecated": true
          },
          "role": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "accepted",
              "declined"
            ]
          },
          "receivedAt": {
            "type": "string",
            "format": "date-time"
          },
          "respondedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PublicationRequestResult": {
        "type": "object",
        "required": [
          "request",
          "traceId"
        ],
        "properties": {
          "request": {
            "$ref": "#/components/schemas/Request"
          },
          "traceId": {
            "type": "string"
          }
        }
      },
      "Goal": {
        "type": "object",
        "required": [
          "id",
          "goalId",
          "agentId",
          "title",
          "intent",
          "mode",
          "type",
          "lifecycleStatus",
          "publicationStatus",
          "visibility",
          "cadence",
          "targeting",
          "context",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "goalId": {
            "type": "string",
            "description": "Canonical Goal identifier. Equal to id."
          },
          "agentId": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "intent": {
            "type": "string"
          },
          "mode": {
            "$ref": "#/components/schemas/WorkMode"
          },
          "type": {
            "type": "string",
            "enum": [
              "DEMAND",
              "SUPPLY",
              "CHAT"
            ],
            "deprecated": true,
            "description": "Deprecated compatibility representation. Use mode."
          },
          "lifecycleStatus": {
            "type": "string",
            "enum": [
              "DRAFT",
              "ACTIVE",
              "PAUSED",
              "COMPLETED",
              "ARCHIVED"
            ]
          },
          "publicationStatus": {
            "type": "string",
            "enum": [
              "NOT_PUBLISHED",
              "REQUESTED",
              "PUBLISHING",
              "PUBLISHED",
              "FAILED"
            ]
          },
          "visibility": {
            "$ref": "#/components/schemas/Visibility"
          },
          "accessPolicyId": {
            "type": [
              "string",
              "null"
            ]
          },
          "pausedUntil": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "archivedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "cadence": {
            "type": "object",
            "additionalProperties": true
          },
          "targeting": {
            "type": "object",
            "additionalProperties": true
          },
          "context": {
            "type": "object",
            "additionalProperties": true
          },
          "publication": {
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": true
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Task": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Goal"
          },
          {
            "type": "object",
            "required": [
              "taskId"
            ],
            "properties": {
              "taskId": {
                "type": "string",
                "deprecated": true,
                "description": "Deprecated compatibility alias for goalId."
              }
            }
          }
        ]
      },
      "Deal": {
        "type": "object",
        "required": [
          "id",
          "agentId",
          "goalId",
          "mode",
          "direction",
          "title",
          "status",
          "visibility",
          "terms",
          "counterparty",
          "createdAt",
          "updatedAt"
        ],
        "description": "A customer-safe commercial work record. Darwin keeps matching, routing, and provider identifiers private.",
        "properties": {
          "id": {
            "type": "string"
          },
          "agentId": {
            "type": "string"
          },
          "taskId": {
            "type": [
              "string",
              "null"
            ],
            "deprecated": true,
            "description": "Deprecated compatibility alias for goalId."
          },
          "goalId": {
            "type": [
              "string",
              "null"
            ]
          },
          "mode": {
            "type": "string",
            "enum": [
              "BUY",
              "SELL"
            ]
          },
          "direction": {
            "type": "string",
            "enum": [
              "demand",
              "supply"
            ],
            "deprecated": true,
            "description": "Deprecated compatibility field. Use mode."
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "sent",
              "accepted",
              "rejected",
              "withdrawn"
            ]
          },
          "visibility": {
            "$ref": "#/components/schemas/Visibility"
          },
          "accessPolicyId": {
            "type": [
              "string",
              "null"
            ]
          },
          "terms": {
            "type": "object",
            "additionalProperties": true
          },
          "counterparty": {
            "type": "object",
            "additionalProperties": true
          },
          "traceId": {
            "type": [
              "string",
              "null"
            ]
          },
          "sentAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "respondedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Payout": {
        "type": "object",
        "required": [
          "id",
          "amountMinor",
          "currency",
          "status",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "amountMinor": {
            "type": "integer"
          },
          "currency": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "failureReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "transferredAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Transaction": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "transactionId",
          "goalId",
          "dealId",
          "mode",
          "reservedCapMinor",
          "subtotalMinor",
          "darwinFeeMinor",
          "taxAmountMinor",
          "settledAmountMinor",
          "releasedAmountMinor",
          "currency",
          "status",
          "settlementMode",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "transactionId": {
            "type": "string"
          },
          "goalId": {
            "type": "string"
          },
          "taskId": {
            "type": "string",
            "deprecated": true,
            "description": "Deprecated compatibility alias for goalId."
          },
          "dealId": {
            "type": "string"
          },
          "mode": {
            "$ref": "#/components/schemas/WorkMode"
          },
          "offerId": {
            "type": "string",
            "deprecated": true,
            "description": "Deprecated compatibility alias for dealId."
          },
          "reservedCapMinor": {
            "type": "integer",
            "minimum": 0
          },
          "amountMinor": {
            "type": "integer",
            "minimum": 0,
            "deprecated": true
          },
          "subtotalMinor": {
            "type": "integer",
            "minimum": 0
          },
          "darwinFeeMinor": {
            "type": "integer",
            "minimum": 0
          },
          "feeBps": {
            "type": "integer",
            "minimum": 0
          },
          "feeAttributionReason": {
            "type": "string"
          },
          "feePolicyVersion": {
            "type": "integer",
            "minimum": 1
          },
          "taxAmountMinor": {
            "type": "integer",
            "minimum": 0
          },
          "settledAmountMinor": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "releasedAmountMinor": {
            "type": "integer",
            "minimum": 0
          },
          "refundedAmountMinor": {
            "type": "integer",
            "minimum": 0
          },
          "currency": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "settlementMode": {
            "type": "string",
            "enum": [
              "fixed",
              "performance"
            ]
          },
          "fundedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "transferredAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "refundedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "disputedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "canceledAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "TransactionFundingResult": {
        "type": "object",
        "required": [
          "state",
          "transaction"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "ready",
              "requires_funding"
            ]
          },
          "transaction": {
            "$ref": "#/components/schemas/Transaction"
          },
          "fundingAmountMinor": {
            "type": "integer",
            "minimum": 0
          },
          "fundingRail": {
            "type": [
              "string",
              "null"
            ]
          },
          "clientSecret": {
            "type": [
              "string",
              "null"
            ],
            "writeOnly": true
          }
        }
      },
      "Outcome": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "id",
          "outcomeId",
          "sessionId",
          "goalId",
          "mode",
          "status",
          "canonical",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "outcomeId": {
            "type": "string"
          },
          "sessionId": {
            "type": "string"
          },
          "goalId": {
            "type": [
              "string",
              "null"
            ]
          },
          "taskId": {
            "type": [
              "string",
              "null"
            ],
            "deprecated": true,
            "description": "Deprecated compatibility alias for goalId."
          },
          "dealId": {
            "type": [
              "string",
              "null"
            ]
          },
          "mode": {
            "$ref": "#/components/schemas/WorkMode"
          },
          "status": {
            "type": "string"
          },
          "canonical": {
            "type": "boolean",
            "const": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OutcomeEvidence": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "outcomeId",
          "sourcePrincipalType",
          "goalId",
          "digest",
          "verificationStatus",
          "disputeState",
          "submittedAt",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "outcomeId": {
            "type": "string"
          },
          "sourcePrincipalType": {
            "type": "string",
            "enum": [
              "customer",
              "application",
              "provider",
              "counterparty"
            ]
          },
          "goalId": {
            "type": [
              "string",
              "null"
            ]
          },
          "taskId": {
            "type": [
              "string",
              "null"
            ],
            "deprecated": true,
            "description": "Deprecated compatibility alias for goalId."
          },
          "dealId": {
            "type": [
              "string",
              "null"
            ]
          },
          "digest": {
            "type": "object",
            "required": [
              "algorithm",
              "value"
            ],
            "properties": {
              "algorithm": {
                "type": "string",
                "const": "sha-256"
              },
              "value": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              }
            }
          },
          "signedReference": {
            "type": [
              "string",
              "null"
            ]
          },
          "verificationStatus": {
            "type": "string",
            "enum": [
              "pending",
              "verified",
              "rejected"
            ]
          },
          "disputeState": {
            "type": "string",
            "enum": [
              "none",
              "open",
              "resolved"
            ]
          },
          "submittedAt": {
            "type": "string",
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Payment": {
        "type": "object",
        "required": [
          "id",
          "agentId",
          "amountMinor",
          "currency",
          "description",
          "status",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "agentId": {
            "type": "string"
          },
          "goalId": {
            "type": [
              "string",
              "null"
            ]
          },
          "dealId": {
            "type": [
              "string",
              "null"
            ]
          },
          "amountMinor": {
            "type": "integer"
          },
          "currency": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "checkoutUrl": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "paidAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "canceledAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          },
          "payout": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Payout"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Application": {
        "type": "object",
        "required": [
          "id",
          "name",
          "slug",
          "mode",
          "status",
          "redirectUris",
          "defaultAgentKind",
          "defaultVisibility",
          "metadata",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "websiteUrl": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "mode": {
            "type": "string",
            "enum": [
              "hosted",
              "embedded",
              "hybrid"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "archived"
            ]
          },
          "redirectUris": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            }
          },
          "defaultAgentKind": {
            "type": "string",
            "enum": [
              "personal",
              "business"
            ]
          },
          "defaultVisibility": {
            "$ref": "#/components/schemas/Visibility"
          },
          "oauth": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "clientId",
                  "authorizationUrl",
                  "tokenUrl",
                  "requirePKCE"
                ],
                "properties": {
                  "clientId": {
                    "type": "string"
                  },
                  "authorizationUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "tokenUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "requirePKCE": {
                    "type": "boolean"
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Integrations": {
        "type": "object",
        "required": [
          "catalog",
          "connections",
          "skills"
        ],
        "properties": {
          "catalog": {
            "type": "object",
            "required": [
              "enabled",
              "toolkits"
            ],
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "toolkits": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "connections": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "skills": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          }
        }
      },
      "ApplicationAgentLink": {
        "type": "object",
        "required": [
          "id",
          "status"
        ],
        "additionalProperties": true,
        "properties": {
          "id": {
            "type": "string"
          },
          "applicationId": {
            "type": "string"
          },
          "agentIdentityId": {
            "type": "string"
          },
          "externalReference": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "REVOKED"
            ]
          },
          "visibility": {
            "$ref": "#/components/schemas/Visibility"
          },
          "permissions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          },
          "linkedAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "agentIdentity": {
            "type": "object",
            "additionalProperties": true,
            "properties": {
              "id": {
                "type": "string"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "PERSONAL",
                  "BUSINESS"
                ]
              },
              "name": {
                "type": "string"
              },
              "handle": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "avatarUrl": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uri"
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "visibility": {
                "$ref": "#/components/schemas/Visibility"
              }
            }
          }
        }
      },
      "EnrollmentLink": {
        "type": "object",
        "required": [
          "id",
          "applicationId"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "applicationId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "codePrefix": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "HOSTED",
              "EMBEDDED",
              "HYBRID"
            ]
          },
          "defaultAgentKind": {
            "type": "string",
            "enum": [
              "PERSONAL",
              "BUSINESS"
            ]
          },
          "defaultVisibility": {
            "$ref": "#/components/schemas/Visibility"
          },
          "maxUses": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1
          },
          "useCount": {
            "type": "integer",
            "minimum": 0
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "revokedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "settings": {
            "type": "object",
            "additionalProperties": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CreatedEnrollmentLink": {
        "allOf": [
          {
            "$ref": "#/components/schemas/EnrollmentLink"
          },
          {
            "type": "object",
            "required": [
              "token",
              "url"
            ],
            "properties": {
              "token": {
                "type": "string",
                "description": "Returned only once."
              },
              "url": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        ]
      },
      "EnrollmentBatch": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "applicationId",
          "status",
          "totalCount",
          "readyCount",
          "failedCount",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "applicationId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "processing",
              "completed",
              "partial",
              "failed"
            ]
          },
          "totalCount": {
            "type": "integer",
            "minimum": 1
          },
          "readyCount": {
            "type": "integer",
            "minimum": 0
          },
          "failedCount": {
            "type": "integer",
            "minimum": 0
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EnrollmentBatchItem": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "externalReference",
          "status",
          "enrollmentUrl",
          "errorCode",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "externalReference": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "ready",
              "failed",
              "consumed",
              "expired"
            ]
          },
          "enrollmentUrl": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "errorCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EnrollmentBatchResult": {
        "type": "object",
        "required": [
          "batch",
          "items",
          "page"
        ],
        "properties": {
          "batch": {
            "$ref": "#/components/schemas/EnrollmentBatch"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EnrollmentBatchItem"
            }
          },
          "page": {
            "type": "object",
            "required": [
              "nextCursor"
            ],
            "properties": {
              "nextCursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        }
      },
      "EphemeralGoal": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "id",
          "goalId",
          "externalUserReference",
          "accountablePrincipal",
          "mode",
          "intent",
          "status",
          "expiresAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "goalId": {
            "type": "string"
          },
          "externalUserReference": {
            "type": "string"
          },
          "accountablePrincipal": {
            "type": "object",
            "required": [
              "type",
              "applicationId"
            ],
            "properties": {
              "type": {
                "type": "string",
                "const": "application"
              },
              "applicationId": {
                "type": "string"
              }
            }
          },
          "mode": {
            "$ref": "#/components/schemas/WorkMode"
          },
          "title": {
            "type": "string"
          },
          "intent": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "cast",
              "matched",
              "claimed",
              "canceled",
              "expired"
            ]
          },
          "castAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ServiceAccount": {
        "type": "object",
        "required": [
          "id",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "applicationId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "keyPrefix": {
            "type": "string"
          },
          "prefix": {
            "type": "string"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "agents:read",
                "agents:write",
                "members:read",
                "conversations:read",
                "conversations:write",
                "requests:read",
                "requests:write",
                "agent:read",
                "agent:write",
                "tasks:read",
                "tasks:write",
                "goals:read",
                "goals:write",
                "deals:read",
                "deals:write",
                "transactions:read",
                "outcomes:read",
                "outcomes:write",
                "integrations:read",
                "connections:read",
                "permissions:read",
                "reputation:read",
                "skills:read",
                "notifications:read",
                "usage:read",
                "verification:read",
                "deployment:read",
                "ephemeral-goals:read",
                "ephemeral-goals:write",
                "ephemeral-tasks:read",
                "ephemeral-tasks:write"
              ]
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "REVOKED"
            ]
          },
          "requestCount": {
            "type": "integer",
            "minimum": 0
          },
          "lastUsedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "revokedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CreatedServiceAccount": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ServiceAccount"
          },
          {
            "type": "object",
            "required": [
              "apiKey",
              "prefix"
            ],
            "properties": {
              "apiKey": {
                "type": "string",
                "description": "Returned only once."
              },
              "prefix": {
                "type": "string"
              }
            }
          }
        ]
      },
      "Webhook": {
        "type": "object",
        "required": [
          "id",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "applicationId": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "REVOKED"
            ]
          },
          "secretPrefix": {
            "type": "string"
          },
          "lastDeliveredAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "lastFailureAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "failureCount": {
            "type": "integer",
            "minimum": 0
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CreatedWebhook": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Webhook"
          },
          {
            "type": "object",
            "required": [
              "signingSecret"
            ],
            "properties": {
              "signingSecret": {
                "type": "string",
                "description": "Returned only once."
              }
            }
          }
        ]
      },
      "WebhookDelivery": {
        "type": "object",
        "required": [
          "id",
          "eventId",
          "eventType",
          "status",
          "attempts",
          "availableAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "eventId": {
            "type": "string"
          },
          "eventType": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "DELIVERING",
              "DELIVERED",
              "FAILED"
            ]
          },
          "attempts": {
            "type": "integer",
            "minimum": 0
          },
          "availableAt": {
            "type": "string",
            "format": "date-time"
          },
          "responseStatus": {
            "type": [
              "integer",
              "null"
            ]
          },
          "responseBody": {
            "type": [
              "string",
              "null"
            ]
          },
          "lastError": {
            "type": [
              "string",
              "null"
            ]
          },
          "deliveredAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "WorkMode": {
        "type": "string",
        "enum": [
          "BUY",
          "SELL",
          "CHAT"
        ],
        "description": "The workflow view for shared Darwin work resources."
      },
      "Visibility": {
        "type": "string",
        "enum": [
          "PUBLIC",
          "RESTRICTED",
          "PRIVATE"
        ]
      },
      "CreateAgentRequest": {
        "type": "object",
        "required": [
          "name"
        ],
        "additionalProperties": false,
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "business"
            ],
            "default": "business"
          },
          "name": {
            "type": "string",
            "maxLength": 160
          },
          "handle": {
            "type": "string",
            "maxLength": 41
          },
          "avatarUrl": {
            "type": "string",
            "format": "uri"
          },
          "description": {
            "type": "string",
            "maxLength": 5000
          },
          "links": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "capabilities": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "location": {
            "type": "object",
            "additionalProperties": true
          },
          "organization": {
            "type": "object",
            "additionalProperties": true
          },
          "visibility": {
            "$ref": "#/components/schemas/Visibility"
          },
          "profile": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "UpdateAgentRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 160
          },
          "handle": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 41
          },
          "avatarUrl": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 5000
          },
          "links": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "capabilities": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "location": {
            "type": "object",
            "additionalProperties": true
          },
          "organization": {
            "type": "object",
            "additionalProperties": true
          },
          "visibility": {
            "$ref": "#/components/schemas/Visibility"
          },
          "accessPolicyId": {
            "type": [
              "string",
              "null"
            ]
          },
          "profile": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "CreateAgentSkillRequest": {
        "type": "object",
        "required": [
          "name"
        ],
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 100
          },
          "slug": {
            "type": "string",
            "maxLength": 80
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 1000
          },
          "category": {
            "type": "string",
            "enum": [
              "ai",
              "human",
              "hybrid"
            ],
            "default": "ai"
          },
          "visibility": {
            "type": "string",
            "enum": [
              "PRIVATE",
              "PUBLIC"
            ],
            "default": "PUBLIC"
          },
          "instructions": {
            "type": "string",
            "maxLength": 10000
          },
          "enabledActions": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "type": "string"
            }
          },
          "enabled": {
            "type": "boolean",
            "default": true
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "UpdateAgentSkillRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 100
          },
          "slug": {
            "type": "string",
            "maxLength": 80
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 1000
          },
          "category": {
            "type": "string",
            "enum": [
              "ai",
              "human",
              "hybrid"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "PRIVATE",
              "PUBLIC"
            ]
          },
          "instructions": {
            "type": "string",
            "maxLength": 10000
          },
          "enabledActions": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "type": "string"
            }
          },
          "enabled": {
            "type": "boolean"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "CreateAgentAssetRequest": {
        "type": "object",
        "required": [
          "title",
          "sourceUrl"
        ],
        "additionalProperties": false,
        "properties": {
          "title": {
            "type": "string",
            "maxLength": 160
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 1000
          },
          "kind": {
            "type": "string",
            "enum": [
              "image",
              "video",
              "audio",
              "document",
              "data",
              "link",
              "other"
            ],
            "default": "link"
          },
          "sourceUrl": {
            "type": "string",
            "format": "uri",
            "maxLength": 4000
          },
          "previewUrl": {
            "type": "string",
            "format": "uri",
            "maxLength": 4000
          },
          "visibility": {
            "type": "string",
            "enum": [
              "PRIVATE",
              "PUBLIC"
            ],
            "default": "PRIVATE"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "BeginAgentAssetUploadRequest": {
        "type": "object",
        "required": [
          "title",
          "filename",
          "mimeType",
          "byteSize"
        ],
        "additionalProperties": false,
        "properties": {
          "title": {
            "type": "string",
            "maxLength": 160
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 1000
          },
          "filename": {
            "type": "string",
            "maxLength": 255
          },
          "mimeType": {
            "type": "string",
            "maxLength": 200
          },
          "byteSize": {
            "type": "integer",
            "minimum": 1,
            "maximum": 26214400
          },
          "kind": {
            "type": "string",
            "enum": [
              "image",
              "video",
              "audio",
              "document",
              "data",
              "other"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "PRIVATE",
              "PUBLIC"
            ],
            "default": "PRIVATE"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "UpdateAgentAssetRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "title": {
            "type": "string",
            "maxLength": 160
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 1000
          },
          "visibility": {
            "type": "string",
            "enum": [
              "PRIVATE",
              "PUBLIC"
            ]
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "CreateAgentInvitationRequest": {
        "type": "object",
        "required": [
          "email"
        ],
        "additionalProperties": false,
        "properties": {
          "email": {
            "type": "string",
            "format": "email"
          },
          "role": {
            "type": "string",
            "enum": [
              "admin",
              "member"
            ],
            "default": "member"
          }
        }
      },
      "UpdateAgentMemberRequest": {
        "type": "object",
        "required": [
          "role"
        ],
        "additionalProperties": false,
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "admin",
              "member"
            ]
          }
        }
      },
      "AccessPolicyRule": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "agentIds": {
            "type": "array",
            "maxItems": 250,
            "items": {
              "type": "string"
            }
          },
          "verifiedAttributes": {
            "type": "object",
            "minProperties": 1,
            "maxProperties": 50,
            "additionalProperties": {
              "oneOf": [
                {
                  "type": "string",
                  "maxLength": 200
                },
                {
                  "type": "boolean"
                }
              ]
            }
          },
          "geography": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "countries": {
                "type": "array",
                "maxItems": 250,
                "items": {
                  "type": "string",
                  "maxLength": 100
                }
              },
              "regions": {
                "type": "array",
                "maxItems": 250,
                "items": {
                  "type": "string",
                  "maxLength": 100
                }
              }
            }
          }
        }
      },
      "CreateAccessPolicyRequest": {
        "type": "object",
        "required": [
          "name",
          "visibility"
        ],
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "visibility": {
            "$ref": "#/components/schemas/Visibility"
          },
          "naturalLanguage": {
            "type": "string",
            "maxLength": 5000
          },
          "rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccessPolicyRule"
            }
          }
        }
      },
      "UpdateAccessPolicyRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "visibility": {
            "$ref": "#/components/schemas/Visibility"
          },
          "naturalLanguage": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 5000
          },
          "rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccessPolicyRule"
            }
          }
        }
      },
      "CreateAgentMessageRequest": {
        "type": "object",
        "required": [
          "content"
        ],
        "additionalProperties": false,
        "properties": {
          "agentId": {
            "type": "string"
          },
          "content": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20000
          },
          "requestId": {
            "type": "string",
            "maxLength": 200
          }
        }
      },
      "CreateConversationMessageRequest": {
        "type": "object",
        "required": [
          "content"
        ],
        "additionalProperties": false,
        "properties": {
          "content": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20000
          },
          "requestId": {
            "type": "string",
            "maxLength": 200
          }
        }
      },
      "ExecuteToolRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "input": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "CreateGoalRequest": {
        "type": "object",
        "required": [
          "intent"
        ],
        "additionalProperties": false,
        "properties": {
          "agentId": {
            "type": "string"
          },
          "title": {
            "type": "string",
            "maxLength": 160
          },
          "intent": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20000
          },
          "mode": {
            "$ref": "#/components/schemas/WorkMode"
          },
          "type": {
            "type": "string",
            "enum": [
              "DEMAND",
              "SUPPLY",
              "CHAT"
            ],
            "deprecated": true,
            "description": "Deprecated compatibility representation. Use mode."
          },
          "lifecycleStatus": {
            "type": "string",
            "enum": [
              "DRAFT",
              "ACTIVE"
            ],
            "default": "ACTIVE"
          },
          "visibility": {
            "$ref": "#/components/schemas/Visibility"
          },
          "accessPolicyId": {
            "type": "string"
          },
          "cadence": {
            "type": "object",
            "additionalProperties": true
          },
          "targeting": {
            "type": "object",
            "additionalProperties": true
          },
          "context": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "CreateTaskRequest": {
        "$ref": "#/components/schemas/CreateGoalRequest"
      },
      "UpdateGoalRequest": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "maxLength": 160
          },
          "intent": {
            "type": "string",
            "maxLength": 20000
          },
          "mode": {
            "$ref": "#/components/schemas/WorkMode"
          },
          "type": {
            "type": "string",
            "enum": [
              "DEMAND",
              "SUPPLY",
              "CHAT"
            ],
            "deprecated": true,
            "description": "Deprecated compatibility representation. Use mode."
          },
          "lifecycleStatus": {
            "type": "string",
            "enum": [
              "DRAFT",
              "ACTIVE",
              "PAUSED",
              "COMPLETED",
              "ARCHIVED"
            ]
          },
          "visibility": {
            "$ref": "#/components/schemas/Visibility"
          },
          "accessPolicyId": {
            "type": [
              "string",
              "null"
            ]
          },
          "pausedUntil": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "cadence": {
            "type": "object",
            "additionalProperties": true
          },
          "targeting": {
            "type": "object",
            "additionalProperties": true
          },
          "context": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "UpdateTaskRequest": {
        "$ref": "#/components/schemas/UpdateGoalRequest"
      },
      "GoalActionRequest": {
        "type": "object",
        "required": [
          "action"
        ],
        "additionalProperties": false,
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "PAUSE",
              "RESUME",
              "COMPLETE",
              "ARCHIVE"
            ]
          },
          "pausedUntil": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "TaskActionRequest": {
        "$ref": "#/components/schemas/GoalActionRequest"
      },
      "PublicationRequest": {
        "type": "object",
        "properties": {
          "objective": {
            "type": "object",
            "additionalProperties": true
          },
          "idempotencyKey": {
            "type": "string",
            "maxLength": 250
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "RequestActionRequest": {
        "type": "object",
        "required": [
          "action"
        ],
        "additionalProperties": false,
        "properties": {
          "agentId": {
            "type": "string",
            "description": "Optional explicit agent scope. When omitted, Darwin uses the caller’s selected agent."
          },
          "action": {
            "type": "string",
            "enum": [
              "ACCEPT",
              "DECLINE"
            ]
          }
        }
      },
      "CreateDealRequest": {
        "type": "object",
        "required": [
          "mode",
          "title"
        ],
        "additionalProperties": false,
        "properties": {
          "agentId": {
            "type": "string",
            "description": "Optional explicit agent scope. When omitted, Darwin uses the caller’s selected agent."
          },
          "goalId": {
            "type": "string"
          },
          "taskId": {
            "type": "string",
            "deprecated": true,
            "description": "Deprecated compatibility alias for goalId."
          },
          "mode": {
            "type": "string",
            "enum": [
              "BUY",
              "SELL"
            ]
          },
          "direction": {
            "type": "string",
            "enum": [
              "DEMAND",
              "SUPPLY"
            ],
            "deprecated": true,
            "description": "Deprecated compatibility field. Use mode."
          },
          "title": {
            "type": "string",
            "maxLength": 160
          },
          "visibility": {
            "$ref": "#/components/schemas/Visibility"
          },
          "accessPolicyId": {
            "type": "string"
          },
          "terms": {
            "type": "object",
            "additionalProperties": true
          },
          "counterparty": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "DealActionRequest": {
        "type": "object",
        "required": [
          "action"
        ],
        "additionalProperties": false,
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "SEND",
              "ACCEPT",
              "REJECT",
              "WITHDRAW"
            ]
          }
        }
      },
      "TransactionActionRequest": {
        "type": "object",
        "required": [
          "action"
        ],
        "additionalProperties": false,
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "CANCEL",
              "REQUEST_REFUND"
            ]
          },
          "amountMinor": {
            "type": "integer",
            "minimum": 1,
            "description": "Optional partial refund amount. Omit to request the remaining refundable amount."
          }
        }
      },
      "SubmitOutcomeEvidenceRequest": {
        "type": "object",
        "required": [
          "evidenceDigest"
        ],
        "additionalProperties": false,
        "properties": {
          "evidenceDigest": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "signedReference": {
            "type": "string",
            "maxLength": 10000
          },
          "dealId": {
            "type": "string"
          }
        }
      },
      "UpdateDealRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "title": {
            "type": "string",
            "maxLength": 160
          },
          "visibility": {
            "$ref": "#/components/schemas/Visibility"
          },
          "accessPolicyId": {
            "type": [
              "string",
              "null"
            ]
          },
          "terms": {
            "type": "object",
            "additionalProperties": true
          },
          "counterparty": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "CreateApplicationRequest": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 160
          },
          "description": {
            "type": "string",
            "maxLength": 5000
          },
          "websiteUrl": {
            "type": "string",
            "format": "uri"
          },
          "mode": {
            "type": "string",
            "enum": [
              "HOSTED",
              "EMBEDDED",
              "HYBRID"
            ],
            "default": "HOSTED"
          },
          "redirectUris": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            }
          },
          "defaultAgentKind": {
            "type": "string",
            "enum": [
              "PERSONAL",
              "BUSINESS"
            ],
            "default": "BUSINESS"
          },
          "defaultVisibility": {
            "$ref": "#/components/schemas/Visibility"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "UpdateApplicationRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 160
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 5000
          },
          "websiteUrl": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "mode": {
            "type": "string",
            "enum": [
              "HOSTED",
              "EMBEDDED",
              "HYBRID"
            ]
          },
          "redirectUris": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            }
          },
          "defaultAgentKind": {
            "type": "string",
            "enum": [
              "PERSONAL",
              "BUSINESS"
            ]
          },
          "defaultVisibility": {
            "$ref": "#/components/schemas/Visibility"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "LinkApplicationAgentRequest": {
        "type": "object",
        "required": [
          "agentId"
        ],
        "properties": {
          "agentId": {
            "type": "string"
          },
          "externalReference": {
            "type": "string"
          },
          "visibility": {
            "$ref": "#/components/schemas/Visibility"
          },
          "permissions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "CreateEnrollmentLinkRequest": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 160
          },
          "mode": {
            "type": "string",
            "enum": [
              "HOSTED",
              "EMBEDDED",
              "HYBRID"
            ]
          },
          "defaultAgentKind": {
            "type": "string",
            "enum": [
              "PERSONAL",
              "BUSINESS"
            ]
          },
          "defaultVisibility": {
            "$ref": "#/components/schemas/Visibility"
          },
          "maxUses": {
            "type": "integer",
            "minimum": 1
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "settings": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "CreateEnrollmentBatchRequest": {
        "type": "object",
        "required": [
          "externalReferences"
        ],
        "additionalProperties": false,
        "properties": {
          "externalReferences": {
            "type": "array",
            "minItems": 1,
            "maxItems": 1000,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            }
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CreateEphemeralGoalRequest": {
        "type": "object",
        "required": [
          "externalUserReference",
          "mode",
          "intent",
          "targeting",
          "budget"
        ],
        "additionalProperties": false,
        "properties": {
          "externalUserReference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "mode": {
            "$ref": "#/components/schemas/WorkMode"
          },
          "title": {
            "type": "string",
            "maxLength": 160
          },
          "intent": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20000
          },
          "targeting": {
            "type": "object",
            "additionalProperties": true
          },
          "budget": {
            "type": "object",
            "additionalProperties": true
          },
          "reviewedFields": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "EphemeralGoalActionRequest": {
        "type": "object",
        "required": [
          "action"
        ],
        "additionalProperties": false,
        "properties": {
          "action": {
            "type": "string",
            "const": "CANCEL"
          }
        }
      },
      "CreateServiceAccountRequest": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 160
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "agents:read",
                "agents:write",
                "members:read",
                "conversations:read",
                "conversations:write",
                "requests:read",
                "requests:write",
                "agent:read",
                "agent:write",
                "tasks:read",
                "tasks:write",
                "goals:read",
                "goals:write",
                "deals:read",
                "deals:write",
                "transactions:read",
                "outcomes:read",
                "outcomes:write",
                "integrations:read",
                "connections:read",
                "permissions:read",
                "reputation:read",
                "skills:read",
                "notifications:read",
                "usage:read",
                "verification:read",
                "deployment:read",
                "ephemeral-goals:read",
                "ephemeral-goals:write",
                "ephemeral-tasks:read",
                "ephemeral-tasks:write"
              ]
            }
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CreateWebhookRequest": {
        "type": "object",
        "required": [
          "url",
          "events"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "agent.created",
                "agent.updated",
                "goal.created",
                "goal.updated",
                "goal.published",
                "deal.created",
                "deal.updated",
                "payment.updated"
              ]
            }
          }
        }
      },
      "AgentReputation": {
        "type": "object",
        "required": [
          "agentId",
          "tier",
          "score",
          "verifiedReliability",
          "incidentCount"
        ],
        "properties": {
          "agentId": {
            "type": "string"
          },
          "tier": {
            "type": "string",
            "enum": [
              "EXCELLENT",
              "STRONG",
              "ESTABLISHED",
              "DEVELOPING"
            ]
          },
          "score": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "verifiedReliability": {
            "type": "object",
            "required": [
              "completedTransactions",
              "observedTransactions",
              "reliabilityBps"
            ],
            "properties": {
              "completedTransactions": {
                "type": "integer",
                "minimum": 0
              },
              "observedTransactions": {
                "type": "integer",
                "minimum": 0
              },
              "reliabilityBps": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0,
                "maximum": 10000
              }
            }
          },
          "incidentCount": {
            "type": "integer",
            "minimum": 0
          },
          "updatedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "AgentPermissions": {
        "type": "object",
        "required": [
          "agentId",
          "visibility",
          "profileAccessPolicyId",
          "outboundAccessPolicyId",
          "accessPolicies"
        ],
        "properties": {
          "agentId": {
            "type": "string"
          },
          "visibility": {
            "type": "string",
            "enum": [
              "PUBLIC",
              "RESTRICTED",
              "PRIVATE"
            ]
          },
          "profileAccessPolicyId": {
            "type": [
              "string",
              "null"
            ]
          },
          "outboundAccessPolicyId": {
            "type": [
              "string",
              "null"
            ]
          },
          "accessPolicies": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          }
        }
      },
      "AgentNotifications": {
        "type": "object",
        "required": [
          "agentId",
          "preferences"
        ],
        "properties": {
          "agentId": {
            "type": "string"
          },
          "preferences": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          }
        }
      },
      "AgentUsage": {
        "type": "object",
        "required": [
          "agentId",
          "agentUsage",
          "wallet",
          "activeGoals",
          "activeDeals"
        ],
        "properties": {
          "agentId": {
            "type": "string"
          },
          "agentUsage": {
            "type": "object",
            "required": [
              "currency",
              "capturedMinor",
              "reservedMinor"
            ],
            "properties": {
              "currency": {
                "type": "string",
                "enum": [
                  "usd"
                ]
              },
              "capturedMinor": {
                "type": "integer",
                "minimum": 0
              },
              "reservedMinor": {
                "type": "integer",
                "minimum": 0
              }
            }
          },
          "wallet": {
            "type": "object",
            "additionalProperties": true
          },
          "activeGoals": {
            "type": "integer",
            "minimum": 0
          },
          "activeTasks": {
            "type": "integer",
            "minimum": 0,
            "deprecated": true,
            "description": "Deprecated compatibility alias for activeGoals."
          },
          "activeDeals": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "AgentVerification": {
        "type": "object",
        "required": [
          "agentId",
          "identity",
          "payments"
        ],
        "properties": {
          "agentId": {
            "type": "string"
          },
          "identity": {
            "type": "object",
            "additionalProperties": true
          },
          "payments": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "AgentDeploymentRequest": {
        "type": "object",
        "required": [
          "id",
          "agentIdentityId",
          "target",
          "status",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "agentIdentityId": {
            "type": "string"
          },
          "target": {
            "type": "string",
            "enum": [
              "DARWIN_CLOUD",
              "DARWIN_PRIVATE_CLOUD",
              "SELF_HOSTED"
            ]
          },
          "status": {
            "type": "string"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AgentDeployment": {
        "type": "object",
        "required": [
          "agentId",
          "current",
          "options",
          "requests"
        ],
        "properties": {
          "agentId": {
            "type": "string"
          },
          "current": {
            "type": "string",
            "enum": [
              "DARWIN_CLOUD",
              "DARWIN_PRIVATE_CLOUD",
              "SELF_HOSTED"
            ]
          },
          "options": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "requests": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgentDeploymentRequest"
            }
          }
        }
      },
      "CreateAgentDeploymentRequest": {
        "type": "object",
        "required": [
          "target"
        ],
        "properties": {
          "target": {
            "type": "string",
            "enum": [
              "DARWIN_CLOUD",
              "DARWIN_PRIVATE_CLOUD",
              "SELF_HOSTED"
            ]
          },
          "reason": {
            "type": "string",
            "maxLength": 5000
          },
          "requirements": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "IntegrationCatalog": {
        "type": "object",
        "additionalProperties": true
      },
      "Connection": {
        "type": "object",
        "description": "A sanitized provider account and its toolkit grants. Provider token material is never returned.",
        "additionalProperties": true
      },
      "CreateConnectionAuthorizationRequest": {
        "type": "object",
        "required": [
          "toolkit",
          "requestId"
        ],
        "properties": {
          "toolkit": {
            "type": "string"
          },
          "requestId": {
            "type": "string",
            "maxLength": 200
          }
        }
      },
      "CompleteConnectionAuthorizationRequest": {
        "type": "object",
        "required": [
          "attemptToken"
        ],
        "properties": {
          "attemptToken": {
            "type": "string",
            "maxLength": 2000
          }
        }
      },
      "ConnectionAuthorizationSession": {
        "type": "object",
        "additionalProperties": true
      },
      "ConnectionAuthorizationCompletion": {
        "type": "object",
        "required": [
          "completed",
          "connectionId",
          "status"
        ],
        "properties": {
          "completed": {
            "type": "boolean"
          },
          "connectionId": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        }
      },
      "ConnectionGrantDisableResult": {
        "type": "object",
        "required": [
          "disabled"
        ],
        "properties": {
          "disabled": {
            "type": "boolean",
            "const": true
          }
        }
      },
      "ConnectionRemovalResult": {
        "type": "object",
        "required": [
          "disconnected",
          "revocationPending"
        ],
        "properties": {
          "disconnected": {
            "type": "boolean"
          },
          "revocationPending": {
            "type": "boolean"
          }
        }
      },
      "ApplicationWallet": {
        "type": "object",
        "required": [
          "applicationId",
          "currency",
          "availableAmountMinor",
          "reservedAmountMinor",
          "operationalAvailableAmountMinor",
          "operationalReservedAmountMinor",
          "pendingFeeEarningsMinor",
          "availableFeeEarningsMinor"
        ],
        "properties": {
          "applicationId": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "availableAmountMinor": {
            "type": "integer",
            "minimum": 0
          },
          "reservedAmountMinor": {
            "type": "integer",
            "minimum": 0
          },
          "operationalAvailableAmountMinor": {
            "type": "integer",
            "minimum": 0
          },
          "operationalReservedAmountMinor": {
            "type": "integer",
            "minimum": 0
          },
          "pendingFeeEarningsMinor": {
            "type": "integer",
            "minimum": 0
          },
          "availableFeeEarningsMinor": {
            "type": "integer"
          }
        }
      },
      "FundApplicationWalletRequest": {
        "type": "object",
        "required": [
          "agentId",
          "amountMinor",
          "currency"
        ],
        "properties": {
          "agentId": {
            "type": "string"
          },
          "amountMinor": {
            "type": "integer",
            "minimum": 1
          },
          "currency": {
            "type": "string",
            "minLength": 3,
            "maxLength": 3
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "integer"
          },
          "message": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ]
          },
          "error": {
            "type": "string"
          }
        }
      }
    }
  }
}
