> ## 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.

# Upload Task Attachments

> Upload files for current task chat context.



## OpenAPI

````yaml /openapi.json post /api/tasks/{task_id}/attachments
openapi: 3.1.0
info:
  description: >-
    Public CodeCobra API. Authenticate by sending a personal API key in the
    `Authorization: Bearer <key>` header. Generate keys from Settings → API keys
    in the CodeCobra dashboard.
  title: CodeCobra Public API
  version: 1.0.0
servers: []
security: []
paths:
  /api/tasks/{task_id}/attachments:
    post:
      tags:
        - public
      summary: Upload Task Attachments
      description: Upload files for current task chat context.
      operationId: upload_task_attachments_api_tasks__task_id__attachments_post
      parameters:
        - in: path
          name: task_id
          required: true
          schema:
            format: uuid
            title: Task Id
            type: string
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: >-
                #/components/schemas/Body_upload_task_attachments_api_tasks__task_id__attachments_post
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/TaskAttachmentResponse'
                title: >-
                  Response Upload Task Attachments Api Tasks  Task Id 
                  Attachments Post
                type: array
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      security:
        - HTTPBearer: []
components:
  schemas:
    Body_upload_task_attachments_api_tasks__task_id__attachments_post:
      properties:
        files:
          items:
            contentMediaType: application/octet-stream
            type: string
          title: Files
          type: array
      required:
        - files
      title: Body_upload_task_attachments_api_tasks__task_id__attachments_post
      type: object
    TaskAttachmentResponse:
      properties:
        created_at:
          format: date-time
          title: Created At
          type: string
        filename:
          title: Filename
          type: string
        id:
          format: uuid
          title: Id
          type: string
        mime_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Mime Type
        size_bytes:
          title: Size Bytes
          type: integer
        task_id:
          format: uuid
          title: Task Id
          type: string
      required:
        - id
        - task_id
        - filename
        - size_bytes
        - created_at
      title: TaskAttachmentResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      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:
    HTTPBearer:
      scheme: bearer
      type: http

````