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

# List Tasks

> List tasks, optionally filtered by project or organization.

Without `organization_id`: returns tasks where the caller is the
creator (`Task.user_id == current_user.id`).

With `organization_id`: returns every task in projects owned by
the given organization, regardless of creator. Caller must be an
owner or admin of the organization. Lets external integrations
(eg. the rt_connector_codecobra Odoo module) ingest the org's full
task graph for cost attribution.



## OpenAPI

````yaml /openapi.json get /api/tasks
openapi: 3.1.0
info:
  description: >

    The CodeCobra API drives the same product the dashboard does: create a

    project, open a task against it, watch the agent work, and merge what it

    builds.


    ## Authenticating


    Send a personal API key as a bearer token on every request:


    ```

    Authorization: Bearer cc_your_key_here

    ```


    Mint a key from **Settings → API keys** in the dashboard. A key carries the

    full access of the user who created it, including every organization they

    belong to, so treat it like a password and point automations at a user with

    the access they actually need.


    ## What is not here


    A few dashboard actions are deliberately absent, because an API key should
    not

    be able to widen its own reach or start a flow only a browser can finish:


    * signing in, signing up, password resets and two-factor enrolment;

    * creating, listing or revoking API keys — a leaked key cannot mint another;

    * linking or unlinking a Google or GitHub identity;

    * connecting or disconnecting a GitHub App installation, which needs an
    OAuth
      round-trip in a browser to restore.

    Everything else the dashboard can do is in this reference.


    ## Conventions


    Identifiers are UUIDs. Timestamps are ISO 8601 in UTC. Money is a decimal

    string in USD. A failed request returns its reason in the `detail` field
    with

    a conventional status code: `401` for a missing or invalid key, `403` when
    the

    key's user lacks access to the object, `404` when it does not exist, and
    `429`

    when a rate limit is in play.
  title: CodeCobra API
  version: 1.0.0
servers: []
security:
  - ApiKeyBearer: []
tags:
  - description: >-
      The profile behind the API key, plus the app-wide configuration an
      integration needs before it can create anything: the Odoo versions on
      offer and the models a task may run on.
    name: Account
  - description: >-
      Projects are the unit of ownership. A project pins an Odoo version and
      edition, carries the GitHub repositories the agent works in, and holds
      every task underneath it. Deleting one removes its tasks, pods and stored
      files.
    name: Projects
  - description: >-
      A task is one conversation with the agent inside a project. These
      endpoints create tasks, drive the chat, stream the response, manage
      attachments, and start the pod the agent runs in.
    name: Tasks
  - description: >-
      The plan the agent writes before it builds, its revision history, and the
      files a task produces. Approving a plan is what releases the agent to
      start work.
    name: Plans & Artifacts
  - description: >-
      The pull requests a task opens: checking CI, asking the agent to fix a red
      build, choosing a merge target, and merging to a branch that deploys.
    name: Pull Requests & Deploys
  - description: >-
      Odoo databases a task can reach. Credentials are stored per project and
      activated per task; the probe endpoints validate a URL and login before
      anything is saved. Also covers the throwaway Odoo instance a task runs
      against.
    name: Odoo Connections
  - description: >-
      Shared accounts. An organization owns projects on behalf of its members
      and is billed as one entity.
    name: Organizations
  - description: >-
      Who belongs to an organization and at what role, and the invitations that
      put them there.
    name: Members & Invitations
  - description: >-
      Teams group members inside an organization and grant a whole group access
      to a set of projects at once.
    name: Teams
  - description: >-
      The GitHub App installations backing a personal or organization account,
      and the repositories and branches they expose to projects. Connecting and
      disconnecting GitHub needs a browser round-trip and stays in the
      dashboard.
    name: GitHub
  - description: Balance, payment methods, invoices and auto-reload for a personal account.
    name: Billing
  - description: >-
      The same billing operations for an organization, settled against the
      organization's balance rather than a member's.
    name: Organization Billing
  - description: >-
      What has been spent, broken down by task, project or organization, and
      exportable over a date range for billing reconciliation.
    name: Usage
paths:
  /api/tasks:
    get:
      tags:
        - Tasks
      summary: List Tasks
      description: |-
        List tasks, optionally filtered by project or organization.

        Without `organization_id`: returns tasks where the caller is the
        creator (`Task.user_id == current_user.id`).

        With `organization_id`: returns every task in projects owned by
        the given organization, regardless of creator. Caller must be an
        owner or admin of the organization. Lets external integrations
        (eg. the rt_connector_codecobra Odoo module) ingest the org's full
        task graph for cost attribution.
      operationId: list_tasks_api_tasks_get
      parameters:
        - in: query
          name: project_id
          required: false
          schema:
            anyOf:
              - format: uuid
                type: string
              - type: 'null'
            title: Project Id
        - in: query
          name: organization_id
          required: false
          schema:
            anyOf:
              - format: uuid
                type: string
              - type: 'null'
            title: Organization Id
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/TaskResponse'
                title: Response List Tasks Api Tasks Get
                type: array
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      security:
        - HTTPBearer: []
components:
  schemas:
    TaskResponse:
      properties:
        app_ready:
          default: true
          title: App Ready
          type: boolean
        auto_fix_ci:
          default: false
          title: Auto Fix Ci
          type: boolean
        context_pct:
          anyOf:
            - type: number
            - type: 'null'
          title: Context Pct
        context_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Context Tokens
        context_window:
          anyOf:
            - type: integer
            - type: 'null'
          title: Context Window
        cost_usd:
          anyOf:
            - type: number
            - type: 'null'
          title: Cost Usd
        created_at:
          format: date-time
          title: Created At
          type: string
        github_branch:
          anyOf:
            - type: string
            - type: 'null'
          title: Github Branch
        has_plan:
          default: false
          title: Has Plan
          type: boolean
        id:
          format: uuid
          title: Id
          type: string
        machine_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Machine Url
        mode:
          enum:
            - plan
            - build
          title: Mode
          type: string
        name:
          title: Name
          type: string
        plan_version:
          anyOf:
            - type: integer
            - type: 'null'
          title: Plan Version
        project_id:
          format: uuid
          title: Project Id
          type: string
        provisioning_error:
          anyOf:
            - type: string
            - type: 'null'
          title: Provisioning Error
        pull_requests:
          default: []
          items:
            $ref: '#/components/schemas/PullRequestResponse'
          title: Pull Requests
          type: array
        selected_branches:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Selected Branches
        source_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Url
        updated_at:
          format: date-time
          title: Updated At
          type: string
        user_id:
          format: uuid
          title: User Id
          type: string
        workspace_state:
          default: pending
          enum:
            - ready
            - pending
            - error
          title: Workspace State
          type: string
      required:
        - id
        - name
        - project_id
        - user_id
        - mode
        - created_at
        - updated_at
      title: TaskResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    PullRequestResponse:
      properties:
        fix_ci_stuck:
          default: false
          title: Fix Ci Stuck
          type: boolean
        head_branch:
          anyOf:
            - type: string
            - type: 'null'
          title: Head Branch
        id:
          format: uuid
          title: Id
          type: string
        merge_error:
          anyOf:
            - type: string
            - type: 'null'
          title: Merge Error
        merge_state:
          anyOf:
            - type: string
            - type: 'null'
          title: Merge State
        merge_target:
          anyOf:
            - type: string
            - type: 'null'
          title: Merge Target
        pr_number:
          title: Pr Number
          type: integer
        pr_state:
          title: Pr State
          type: string
        pr_url:
          title: Pr Url
          type: string
        repository_id:
          format: uuid
          title: Repository Id
          type: string
        repository_name:
          title: Repository Name
          type: string
        staging_merged_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Staging Merged At
      required:
        - id
        - repository_id
        - repository_name
        - pr_url
        - pr_number
        - pr_state
      title: PullRequestResponse
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    ApiKeyBearer:
      description: A personal API key from Settings → API keys.
      scheme: bearer
      type: http

````