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

# Create task attachment from external source

> Creates an attachment from an external source (Google Drive, Dropbox, OneDrive).



## OpenAPI

````yaml /api-reference/openapi.json post /tasks/{task_id}/attachments/source/{source_type}
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/source/{source_type}:
    post:
      tags:
        - Tasks
      summary: Create task attachment from external source
      description: >-
        Creates an attachment from an external source (Google Drive, Dropbox,
        OneDrive).
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            type: integer
          description: ID of the task
        - name: source_type
          in: path
          required: true
          schema:
            type: string
            enum:
              - GoogleDrive
              - DropBox
              - OneDrive
          description: 'External file source: `GoogleDrive`, `DropBox`, or `OneDrive`'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - filename
                - originalname
              properties:
                filename:
                  type: string
                  description: URL or path of the file in the external provider
                originalname:
                  type: string
                  description: Original file name with extension
                size:
                  type: integer
                  default: 0
                  description: File size in bytes
                available:
                  type: boolean
                  default: true
                  description: Whether the file is visible
                session_token:
                  type: string
                  nullable: true
                  default: null
                  description: Token to group uploads
      responses:
        '200':
          description: Attachment created from external source
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskAttachmentSourceResponse'
        '400':
          description: Invalid source_type
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CORCustomError'
              example:
                status: 400
                name: CORCustomError
                code: AC001
                message: Invalid source type
        '417':
          description: Task not found (validation failed)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorArray'
components:
  schemas:
    TaskAttachmentSourceResponse:
      type: object
      properties:
        id:
          type: integer
        url:
          type: string
        name:
          type: string
        created_at:
          type: string
          format: date-time
        source:
          type: string
          description: Source provider (e.g. `GoogleDrive`)
        size:
          type: integer
        file_type:
          type: string
        media_type:
          type: string
        user_id:
          type: integer
        discussions_id:
          type: integer
          nullable: true
        session_token:
          type: string
          nullable: true
    CORCustomError:
      type: object
      properties:
        status:
          type: integer
        name:
          type: string
        code:
          type: string
        message:
          type: string
    ValidationErrorArray:
      type: array
      items:
        type: object
        properties:
          field:
            type: string
          validation:
            type: string
          message:
            type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````