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

# Upload a file

> Uploads a file as `multipart/form-data` and attaches it to a site. The binary must be sent in the `file` field and may not exceed 100 MB.



## OpenAPI

````yaml /openapi.json post /files
openapi: 3.1.0
info:
  title: Cula Tracking API
  version: 0.3.10
servers:
  - url: https://api.demo.cula.earth/tracking/v1
security: []
tags:
  - name: Organisations
    description: ''
  - name: Sites
    description: ''
  - name: Machines
    description: ''
  - name: Machine Variables
    description: ''
  - name: Machine Data Imports
    description: ''
  - name: Delivery Configs
    description: ''
  - name: Deliveries
    description: ''
  - name: Material Sourcing Configs
    description: ''
  - name: Material Sourcings
    description: ''
  - name: Material Conversion Configs
    description: ''
  - name: Material Conversions
    description: ''
  - name: Material Utilization Configs
    description: ''
  - name: Material Utilizations
    description: ''
  - name: Material Batches
    description: ''
  - name: Material Pools
    description: ''
  - name: Material Containers
    description: ''
  - name: Sinks
    description: ''
  - name: Documents
    description: ''
  - name: Webhooks
    description: ''
paths:
  /files:
    post:
      tags:
        - Files
      summary: Upload a file
      description: >-
        Uploads a file as `multipart/form-data` and attaches it to a site. The
        binary must be sent in the `file` field and may not exceed 100 MB.
      parameters:
        - name: Cula-Organisation-Id
          in: header
          description: >-
            ID of the organisation the request operates on behalf of (e.g.
            `org_...`). Must be an organisation the API client has access to.
          required: true
          schema:
            type: string
            example: org_01k83mfmhgchya944v86ryvhpq
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/CreateFileRequest'
      responses:
        '201':
          description: The metadata of the newly uploaded file.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetFileResponse'
        '400':
          description: Invalid request payload or parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                code: bad_request
                message: The field limit must not be greater than 100.
        '401':
          description: Missing or invalid access token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                code: unauthorized
                message: Invalid or expired token
        '409':
          description: Conflicting resource state.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                code: conflict
                message: >-
                  There exists already an object with external ID MY-CUSTOM-ID
                  within this organisation.
        '415':
          description: Unsupported file type.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                code: unsupported_media_type
                message: The file type is not supported.
        '500':
          description: Unexpected server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                code: internal_server_error
                message: Internal server error.
      security:
        - AccessToken: []
components:
  schemas:
    CreateFileRequest:
      type: object
      properties:
        file:
          type: string
          format: binary
          description: The file to be uploaded.
        site_id:
          type: string
          example: ste_01k8g7aec6dt5zrtamc72ww446
          description: >-
            The ID of the site the file will belong to. Provide exactly one of
            `site_id` or `site_external_id`.
        site_external_id:
          type: string
          example: SITE-EXT-0001
          description: >-
            The external ID you assigned to the site the file will belong to.
            Provide exactly one of `site_id` or `site_external_id`.
          nullable: false
          maxLength: 100
          minLength: 1
          pattern: ^[A-Za-z0-9\-_]+$
        external_id:
          type: string
          example: MY-CUSTOM-ID
          description: >-
            A optional custom ID that can be set to an internal ID from your
            system. This ID must be unique within all objects of the
            organisation you operate in. You can later use this external ID to
            reference and query this object. Be aware that you can update this
            ID later. If you need an immutable ID, use the object ID returned
            when creating the object.
          nullable: false
          maxLength: 100
          minLength: 1
          pattern: ^[A-Za-z0-9\-_]+$
      required:
        - file
    GetFileResponse:
      type: object
      properties:
        id:
          type: string
          example: fle_01kw9grq4tecva35wdpstzcj5z
          description: ID of the file.
        external_id:
          type: string
          nullable: true
          example: MY-CUSTOM-ID
          description: Optionally assigned external ID of the file.
        site:
          description: The site that owns this file.
          allOf:
            - $ref: '#/components/schemas/SiteReference'
        name:
          type: string
          example: sink_confirmation.pdf
          description: The original filename of the uploaded binary.
        type:
          type: string
          example: application/pdf
          description: >-
            The MIME type of the file, detected from its contents at upload
            time.
        size:
          type: integer
          example: 482117
          description: The size of the file in bytes.
        created_at:
          type: string
          format: date-time
          example: '2025-10-10T21:03:58Z'
          description: The ISO 8601 timestamp at which the file was uploaded.
      required:
        - id
        - external_id
        - site
        - name
        - type
        - size
        - created_at
    Error:
      type: object
      properties:
        code:
          type: string
          example: bad_request
        message:
          type: string
          example: The field limit must not be greater than 100.
      required:
        - code
        - message
    SiteReference:
      type: object
      properties:
        id:
          type: string
          nullable: true
          example: ste_01k8g7aec6dt5zrtamc72ww446
        external_id:
          type: string
          nullable: true
          example: SITE-EXT-0001
      description: >-
        References a site by its ID and the external ID you assigned to it (if
        any).
      required:
        - id
        - external_id
  securitySchemes:
    AccessToken:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://auth.demo.cula.earth/oauth2/token
          scopes: {}
      description: >-
        OAuth 2.0 client credentials. Exchange your client_id and client_secret
        for an access token scoped to the organisation that provides data
        access.

````