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

# Upload task attachments

> Uploads one or more files to a task via multipart/form-data.



## OpenAPI

````yaml /api-reference/openapi.json post /tasks/{task_id}/attachments
openapi: 3.1.0
info:
  title: COR API
  description: >-
    The COR API lets you integrate with projectcor.com applications using simple
    HTTP methods, in either XML or JSON formats, making this an ideal API for
    developing integrations with other softwares, external clients or mobile
    applications
  version: 1.0.0
servers:
  - url: https://api.projectcor.com/v1
    description: Production server
security:
  - bearerAuth: []
paths:
  /tasks/{task_id}/attachments:
    post:
      tags:
        - Tasks
      summary: Upload task attachments
      description: Uploads one or more files to a task via multipart/form-data.
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            type: integer
          description: ID of the task (task_log_id)
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
              properties:
                file:
                  type: string
                  format: binary
                  description: File(s) to upload
                available:
                  type: boolean
                  default: true
                  description: Whether the file is visible
                session_token:
                  type: string
                  nullable: true
                  default: null
                  description: Session token to group uploads and defer notification
                attachment_parent_id:
                  type: integer
                  nullable: true
                  default: null
                  description: ID of the parent attachment (for versioning)
                status:
                  type: string
                  nullable: true
                  default: null
                  enum:
                    - approved
                    - pending
                    - required
                    - null
                  description: Attachment status
                created_from:
                  type: string
                  default: task_panel
                  enum:
                    - task_panel
                    - rework
                    - feedback
                  description: Origin of the upload
      responses:
        '200':
          description: Files uploaded successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskAttachmentUploadResponse'
        '400':
          description: No files could be uploaded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AttachmentUploadBadRequest'
        '417':
          description: Task not found (validation failed)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorArray'
components:
  schemas:
    TaskAttachmentUploadResponse:
      type: object
      properties:
        files:
          type: array
          items:
            $ref: '#/components/schemas/TaskAttachmentUploadedFile'
        files_q:
          type: integer
          description: Total number of attachments currently on the task
        errors:
          type: array
          description: >-
            Present only when individual files failed (size exceeded or invalid
            extension)
          items:
            $ref: '#/components/schemas/AttachmentUploadError'
    AttachmentUploadBadRequest:
      type: object
      properties:
        status:
          type: string
          example: ERROR
        code:
          type: string
          example: FS001
        message:
          type: string
          example: Unable to upload any file
        errors:
          type: array
          items:
            $ref: '#/components/schemas/AttachmentUploadError'
    ValidationErrorArray:
      type: array
      items:
        type: object
        properties:
          field:
            type: string
          validation:
            type: string
          message:
            type: string
    TaskAttachmentUploadedFile:
      type: object
      properties:
        id:
          type: integer
        url:
          type: string
        name:
          type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        source:
          type: string
        size:
          type: integer
        filename:
          type: string
          description: Internal storage path
        available:
          type: boolean
        item_id:
          type: integer
        originalname:
          type: string
        attachment_parent_id:
          type: integer
          nullable: true
        file_type:
          type: string
        discussions_id:
          type: integer
          nullable: true
        user_id:
          type: integer
        parent_id:
          type: integer
        type:
          type: string
          description: Parent type (e.g. `tasks`)
        version:
          type: integer
        status:
          type: string
          nullable: true
        token:
          type: string
          description: Unique file token
        company_id:
          type: integer
        task_log_reworks_id:
          type: integer
          nullable: true
        task_log_id:
          type: integer
        media_type:
          type: string
        graphics_count:
          type: string
          nullable: true
        created_from:
          type: string
    AttachmentUploadError:
      type: object
      properties:
        filename:
          type: string
        message:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````