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

# Get one audited branch

> Use `latest_audit.id` with `cyber.audits.get`.

**Scope:** `cyber:branches:read`. See [API Tokens](https://docs.cloudthinker.io/guide/api/tokens.md#scopes).


## OpenAPI

````yaml /api-reference/openapi.json get /v1/workspaces/{workspace_id}/cyber/branches/{branch_id}
openapi: 3.1.0
info:
  title: CloudThinker Public API
  version: 1.0.0
  description: >-
    Public API v1. Every path names its workspace. IDs are UUIDs. Lists page
    with `limit` and `cursor`. Writes take `Idempotency-Key`. A write runs at
    once when the token's scopes allow it. Clients ask their person first for
    operations marked `x-confirm`.
servers:
  - url: https://app.cloudthinker.io/api/public
security:
  - bearer: []
tags:
  - name: token
    description: The calling token.
  - name: chat
    description: Ask CloudThinker and read past conversations.
  - name: resolve
    description: Production signals, incidents and root cause analysis.
  - name: review
    description: Code reviews, findings and release risk.
  - name: approvals
    description: Approval requests waiting for a person.
  - name: workspace
    description: Connections and their health.
  - name: optimize
    description: Cloud cost overview, savings findings and anomalies.
  - name: cyber
    description: Pentest apps and findings, code audits.
paths:
  /v1/workspaces/{workspace_id}/cyber/branches/{branch_id}:
    get:
      tags:
        - cyber
      summary: 'Get one audited branch: latest audit and finding counts.'
      description: Use `latest_audit.id` with `cyber.audits.get`.
      operationId: cyber.branches.get
      parameters:
        - $ref: '#/components/parameters/WorkspaceId'
        - name: branch_id
          in: path
          required: true
          description: Branch id.
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: OK
          headers:
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CodeAuditBranchDetail'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
        '429':
          $ref: '#/components/responses/RateLimited'
      security:
        - bearer: []
components:
  parameters:
    WorkspaceId:
      name: workspace_id
      in: path
      required: true
      description: Workspace to act in. Every call names it.
      schema:
        type: string
        format: uuid
  headers:
    X-Request-ID:
      description: Request id. Quote it to support.
      schema:
        type: string
    RateLimit-Limit:
      description: Requests allowed in the current window.
      schema:
        type: integer
    RateLimit-Remaining:
      description: Requests left in the current window.
      schema:
        type: integer
    RateLimit-Reset:
      description: Seconds until the window resets.
      schema:
        type: integer
    Retry-After:
      description: Seconds to wait before retrying.
      schema:
        type: integer
  schemas:
    CodeAuditBranchDetail:
      type: object
      title: CodeAuditBranchDetail
      properties:
        id:
          type: string
          format: uuid
        provider:
          type: string
        repository:
          type: string
          description: Repository path.
        branch:
          type: string
        ref_kind:
          $ref: '#/components/schemas/CodeAuditSourceRefKind'
        release:
          type: boolean
        state:
          anyOf:
            - $ref: '#/components/schemas/CodeAuditBranchState'
            - type: 'null'
        posture:
          $ref: '#/components/schemas/CodeAuditBranchPosture'
        latest_audit_id:
          type:
            - string
            - 'null'
          format: uuid
        latest_audit_at:
          type:
            - string
            - 'null'
          format: date-time
        last_full_scan_at:
          type:
            - string
            - 'null'
          format: date-time
        severity_counts:
          $ref: '#/components/schemas/SeverityCounts'
        confirmed_count:
          type: integer
        needs_verification_count:
          type: integer
        updated_at:
          type: string
          format: date-time
        baseline_sha:
          type:
            - string
            - 'null'
        open_count:
          type: integer
        on_push:
          type: boolean
        active_audit:
          anyOf:
            - $ref: '#/components/schemas/CodeAuditSummary'
            - type: 'null'
        latest_audit:
          anyOf:
            - $ref: '#/components/schemas/CodeAuditSummary'
            - type: 'null'
        status_counts:
          $ref: '#/components/schemas/CodeAuditStatusCounts'
      required:
        - id
        - provider
        - repository
        - branch
        - ref_kind
        - release
        - state
        - posture
        - latest_audit_id
        - latest_audit_at
        - last_full_scan_at
        - severity_counts
        - confirmed_count
        - needs_verification_count
        - updated_at
        - baseline_sha
        - open_count
        - on_push
        - active_audit
        - latest_audit
        - status_counts
      description: 'One branch: latest audit, active audit and finding counts.'
    CodeAuditSourceRefKind:
      type: string
      enum:
        - branch
        - tag
      title: CodeAuditSourceRefKind
    CodeAuditBranchState:
      type: string
      enum:
        - running
        - complete
        - failed
        - partial
        - verification_pending
      title: CodeAuditBranchState
    CodeAuditBranchPosture:
      type: string
      enum:
        - confirmed
        - incomplete
        - needs_verification
        - never_scanned
        - stale
        - no_findings
      title: CodeAuditBranchPosture
    SeverityCounts:
      type: object
      title: SeverityCounts
      properties:
        critical:
          type: integer
        high:
          type: integer
        medium:
          type: integer
        low:
          type: integer
        info:
          type: integer
      required:
        - critical
        - high
        - medium
        - low
        - info
    CodeAuditSummary:
      type: object
      title: CodeAuditSummary
      properties:
        id:
          type: string
          format: uuid
        status:
          $ref: '#/components/schemas/CodeAuditStatus'
        head_sha:
          type: string
        base_sha:
          type:
            - string
            - 'null'
        candidate_count:
          type: integer
        confirmed_count:
          type:
            - integer
            - 'null'
        failure_message:
          type:
            - string
            - 'null'
        started_at:
          type: string
          format: date-time
        finished_at:
          type:
            - string
            - 'null'
          format: date-time
        published_at:
          type:
            - string
            - 'null'
          format: date-time
      required:
        - id
        - status
        - head_sha
        - base_sha
        - candidate_count
        - confirmed_count
        - failure_message
        - started_at
        - finished_at
        - published_at
    CodeAuditStatusCounts:
      type: object
      title: CodeAuditStatusCounts
      properties:
        confirmed:
          type: integer
        needs_verification:
          type: integer
        false_positive:
          type: integer
        fixed:
          type: integer
        fixed_undetected:
          type: integer
        dismissed:
          type: integer
        total:
          type: integer
      required:
        - confirmed
        - needs_verification
        - false_positive
        - fixed
        - fixed_undetected
        - dismissed
        - total
    ApiErrorResponse:
      type: object
      title: ApiErrorResponse
      properties:
        error:
          $ref: '#/components/schemas/ApiErrorDetail'
        request_id:
          type: string
      required:
        - error
        - request_id
      description: >-
        Every non-2xx response. Read `error.code` and `error.action`; quote
        `request_id` to support.
      x-todo:
        - >-
          detail: deprecated untyped compatibility payload; still sent by the
          server, left out of the public contract
    CodeAuditStatus:
      type: string
      enum:
        - static_running
        - static_complete
        - verification_running
        - complete
        - failed
        - partial
        - verification_pending
      title: CodeAuditStatus
    ApiErrorDetail:
      type: object
      title: ApiErrorDetail
      properties:
        code:
          anyOf:
            - $ref: '#/components/schemas/ApiErrorCode'
            - type: string
        category:
          $ref: '#/components/schemas/ApiErrorCategory'
        message:
          type: string
        action:
          anyOf:
            - $ref: '#/components/schemas/ApiErrorAction'
            - type: 'null'
        action_target:
          type:
            - string
            - 'null'
        retryable:
          type: boolean
        field_errors:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/ApiFieldError'
      required:
        - code
        - category
        - message
      x-todo:
        - >-
          context: untyped dict[str, JsonValue] in today's model; type its known
          keys or keep it out of the public contract
    ApiErrorCode:
      type: string
      enum:
        - validation_error
        - unauthenticated
        - forbidden
        - not_found
        - conflict
        - rate_limited
        - dependency_unavailable
        - dependency_timeout
        - internal_error
      title: ApiErrorCode
    ApiErrorCategory:
      type: string
      enum:
        - invalid_input
        - unauthenticated
        - forbidden
        - policy_blocked
        - plan_limit
        - not_found
        - conflict
        - reconnect_required
        - rate_limited
        - dependency_unavailable
        - dependency_timeout
        - internal
      title: ApiErrorCategory
    ApiErrorAction:
      type: string
      enum:
        - fix_input
        - open_settings
        - contact_admin
        - upgrade
        - buy_credits
        - reconnect
        - retry
        - reload
        - sign_in
        - sso_login
        - copy_error_id
      title: ApiErrorAction
    ApiFieldError:
      type: object
      title: ApiFieldError
      properties:
        path:
          type: array
          items:
            anyOf:
              - type: string
              - type: integer
        code:
          type: string
        message:
          type: string
      required:
        - path
        - code
        - message
  responses:
    BadRequest:
      description: The request is malformed.
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
    Unauthenticated:
      description: Missing, expired or revoked token.
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
    Forbidden:
      description: The token lacks the scope, or your role lacks the permission.
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
    NotFound:
      description: Not found in this workspace, or you are not a member.
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
    ValidationError:
      description: A parameter or body field is invalid. See `error.field_errors`.
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
    RateLimited:
      description: Too many requests. Wait `Retry-After` seconds.
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
        Retry-After:
          $ref: '#/components/headers/Retry-After'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: >-
        CloudThinker token: a personal access token `ct_pat_…` (fine-grained
        scopes, created in Settings) or an OAuth access token `ct_oat_…` (1
        hour, from the OAuth flow). Send `Authorization: Bearer <token>`. Scopes
        have the form `module:resource:read|write`; write includes read.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.