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

# Add Files To Collection

> Link existing uploaded files to a collection.



## OpenAPI

````yaml https://www.datalab.to/openapi.json post /api/v1/collections/{collection_id}/files
openapi: 3.1.0
info:
  title: Datalab API
  version: 0.0.1
servers:
  - url: https://www.datalab.to
    description: Datalab API
security: []
paths:
  /api/v1/collections/{collection_id}/files:
    post:
      tags:
        - collections
      summary: Add Files To Collection
      description: Link existing uploaded files to a collection.
      operationId: add_files_to_collection_api_v1_collections__collection_id__files_post
      parameters:
        - name: collection_id
          in: path
          required: true
          schema:
            type: integer
            title: Collection Id
        - name: wos-session
          in: cookie
          required: false
          schema:
            type: string
            title: Wos-Session
        - name: datalab_active_team
          in: cookie
          required: false
          schema:
            type: string
            title: Datalab Active Team
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddFilesToCollectionRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CollectionResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    AddFilesToCollectionRequest:
      properties:
        uploaded_file_ids:
          items:
            type: integer
          type: array
          maxItems: 100
          minItems: 1
          title: Uploaded File Ids
      type: object
      required:
        - uploaded_file_ids
      title: AddFilesToCollectionRequest
    CollectionResponse:
      properties:
        id:
          type: integer
          title: Id
        name:
          type: string
          title: Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        archived:
          type: boolean
          title: Archived
        file_count:
          type: integer
          title: File Count
          default: 0
        files:
          items:
            $ref: '#/components/schemas/CollectionFileResponse'
          type: array
          title: Files
          default: []
        created:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Created
        updated:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Updated
      type: object
      required:
        - id
        - name
        - description
        - archived
        - created
        - updated
      title: CollectionResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    CollectionFileResponse:
      properties:
        uploaded_file_id:
          type: integer
          title: Uploaded File Id
        original_filename:
          type: string
          title: Original Filename
        file_size:
          type: integer
          title: File Size
        content_type:
          type: string
          title: Content Type
        sort_order:
          type: integer
          title: Sort Order
        last_eval_score:
          anyOf:
            - type: number
            - type: 'null'
          title: Last Eval Score
        last_score_breakdown:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          title: Last Score Breakdown
      type: object
      required:
        - uploaded_file_id
        - original_filename
        - file_size
        - content_type
        - sort_order
      title: CollectionFileResponse
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key

````