openapi: 3.0.3 info: title: Devin API (Cognition Labs) Attachments Sessions API description: The Devin API lets you create and drive Devin, Cognition's autonomous AI software engineer, programmatically. This document models the legacy v1 surface (api.devin.ai/v1, still live and documented, authenticated with apk_user_*/apk_* keys) in full - sessions, messages, attachments, knowledge, playbooks, and secrets - plus representative endpoints from the current v3 organizations/enterprise surface (api.devin.ai/v3, authenticated with cog_ service-user or personal access tokens) and the v2/v3 consumption (ACU usage) endpoints. The v2/v3 enterprise surface has additional organization, member, and API-key management endpoints not exhaustively modeled here; see the humanURL/APIReference links in apis.yml for the full documented set. All endpoints are transcribed from Cognition's public documentation at https://docs.devin.ai and have not been exercised against production credentials, which require an active paid Devin plan or Enterprise contract. version: '1.0' contact: name: Cognition url: https://cognition.ai license: name: Proprietary url: https://docs.devin.ai/admin/security servers: - url: https://api.devin.ai/v1 description: Legacy v1 API (apk_user_*/apk_* keys) - url: https://api.devin.ai/v3 description: Current v3 organizations/enterprise API (cog_ keys) security: - bearerAuth: [] tags: - name: Sessions description: Create and manage Devin sessions (v1 legacy surface). paths: /sessions: post: operationId: createSession tags: - Sessions summary: Create a new Devin session description: Creates a new Devin session from a natural-language prompt, optionally seeded with a playbook, snapshot, knowledge, secrets, tags, and a max ACU cap. requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateSessionInput' responses: '200': description: The created (or, if idempotent and matched, existing) session. content: application/json: schema: $ref: '#/components/schemas/CreateSessionResponse' '422': $ref: '#/components/responses/ValidationError' get: operationId: listSessions tags: - Sessions summary: List sessions description: Lists sessions for the organization, with optional filters. parameters: - name: limit in: query schema: type: integer default: 100 - name: offset in: query schema: type: integer default: 0 - name: skip in: query schema: type: integer - name: tags in: query description: Filter sessions by tag. schema: type: array items: type: string style: form explode: true - name: user_email in: query description: Filter sessions by the creator's email address. schema: type: string responses: '200': description: A page of sessions. content: application/json: schema: type: object properties: sessions: type: array items: $ref: '#/components/schemas/SessionSummary' '422': $ref: '#/components/responses/ValidationError' /sessions/{session_id}: parameters: - $ref: '#/components/parameters/SessionId' get: operationId: getSession tags: - Sessions summary: Retrieve session details description: Retrieves full status, message history, and structured output for a session. responses: '200': description: The requested session. content: application/json: schema: $ref: '#/components/schemas/SessionDetail' '422': $ref: '#/components/responses/ValidationError' delete: operationId: terminateSession tags: - Sessions summary: Terminate a session description: Terminates a running session. The session must not already be in an exited state. responses: '200': description: Termination confirmation. content: application/json: schema: type: object properties: detail: type: string '422': $ref: '#/components/responses/ValidationError' /sessions/{session_id}/tags: parameters: - $ref: '#/components/parameters/SessionId' put: operationId: updateSessionTags tags: - Sessions summary: Update session tags description: Replaces the tag list on a session (maximum 50 tags). requestBody: required: true content: application/json: schema: type: object required: - tags properties: tags: type: array maxItems: 50 items: type: string responses: '200': description: Confirmation. content: application/json: schema: type: object properties: detail: type: string '422': $ref: '#/components/responses/ValidationError' components: schemas: SessionStatusEnum: type: string enum: - working - blocked - expired - finished - suspend_requested - suspend_requested_frontend - resume_requested - resume_requested_frontend - resumed SessionSummary: type: object required: - session_id - status - created_at - updated_at properties: session_id: type: string status: type: string status_enum: $ref: '#/components/schemas/SessionStatusEnum' created_at: type: string format: date-time updated_at: type: string format: date-time title: type: string requesting_user_email: type: string playbook_id: type: string snapshot_id: type: string tags: type: array items: type: string pull_request: type: object properties: url: type: string structured_output: type: object additionalProperties: true CreateSessionInput: type: object required: - prompt properties: prompt: type: string description: The task prompt for Devin to work on. title: type: string description: Custom session name; auto-generated if omitted. snapshot_id: type: string playbook_id: type: string knowledge_ids: type: array items: type: string nullable: true description: Null uses all knowledge; empty array uses none. secret_ids: type: array items: type: string nullable: true description: Null uses all secrets; empty array uses none. session_secrets: type: array items: type: object properties: key: type: string value: type: string sensitive: type: boolean structured_output_schema: type: object description: JSON Schema (Draft 7) for validating structured output. Max 64KB. additionalProperties: true tags: type: array maxItems: 50 items: type: string max_acu_limit: type: integer description: Maximum ACU allowance for the session. idempotent: type: boolean default: false unlisted: type: boolean default: false ValidationErrorBody: type: object properties: detail: type: array items: type: object properties: loc: type: array items: type: string msg: type: string type: type: string CreateSessionResponse: type: object required: - session_id - url properties: session_id: type: string url: type: string is_new_session: type: boolean SessionDetail: allOf: - $ref: '#/components/schemas/SessionSummary' - type: object properties: messages: type: array default: [] items: type: object additionalProperties: true parameters: SessionId: name: session_id in: path required: true description: The unique identifier of the session. schema: type: string responses: ValidationError: description: The request payload failed validation. content: application/json: schema: $ref: '#/components/schemas/ValidationErrorBody' securitySchemes: bearerAuth: type: http scheme: bearer description: 'v1/v2 keys are prefixed apk_user_* (personal) or apk_* (service). The current v3 API uses service-user or personal access tokens prefixed cog_. Passed as `Authorization: Bearer YOUR_API_KEY`.'