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

# Upload File to Extraction Table

> Upload a file to an extraction table to create a new row associated with it. This doesn't start an extraction run - use the /run endpoint to start processing the file after uploading.

<Note>
  **This is step 1 of 3** in the async run pattern. After uploading, use the returned `row_id` to [start a run](/api-reference/tables/request-starts-the-analyze-process-for-a-table), then [poll for results](/api-reference/tables/get-ai-run-status-&-result).

  For a single blocking call that handles everything, see [synchronous extraction](/api-reference/unified/synchronous-extraction-for-a-file-end-to-end).
</Note>

## What this does

Creates a row in the extraction table linked to the uploaded file, but does **not** start processing. The returned `row_id` is required for all subsequent operations on this file.

## Example

```bash cURL theme={null}
curl -X POST \
  "https://api.cloudsquid.io/api/projects/my-project/tables/TABLE_ID/files" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "file": "'$(base64 -i invoice.pdf)'",
    "filename": "invoice.pdf",
    "mimetype": "application/pdf",
    "file_type": "binary"
  }'
```

Response:

```json theme={null}
{ "row_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6" }
```

Pass this `row_id` to `POST /run` to start extraction.


## OpenAPI

````yaml post /projects/{project_name}/tables/{table_id}/files
openapi: 3.0.3
info:
  title: Cloudsquid
  description: This is the backend of cloudsquid specification
  termsOfService: cloudsquid.io
  contact:
    email: info@cloudsquid.io
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: 1.0.11
servers:
  - url: https://api.cloudsquid.io/api
    description: API
security:
  - api-key: []
paths:
  /projects/{project_name}/tables/{table_id}/files:
    parameters:
      - name: project_name
        in: path
        required: true
        description: The name of the project
        schema:
          type: string
      - name: table_id
        in: path
        required: true
        description: The ID of the table
        schema:
          type: string
          format: uuid
    post:
      tags:
        - tables
      summary: Upload a new file into a table
      description: >-
        Upload a new document to a table to make it available for storage and
        extraction table
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Document'
      responses:
        '200':
          description: Created extraction job for the uploaded file
          content:
            application/json:
              schema:
                type: object
                properties:
                  row_id:
                    type: string
                    format: uuid
                    description: the extraction row created for the uploaded file
                required:
                  - row_id
        '400':
          description: Bad or malformed request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Something unexpected went wrong internally
components:
  schemas:
    Document:
      type: object
      properties:
        mimetype:
          description: the mimetype of the document being uploaded
          type: string
          enum:
            - application/pdf
            - application/json
            - image/jpg
            - image/jpeg
            - image/png
            - text/csv
            - text/plain
            - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
            - application/vnd.ms-excel
            - video/mp4
            - audio/mp3
            - audio/wav
            - audio/ogg
            - multipart/related
            - message/rfc822
        filename:
          description: the name of the file being uploaded
          type: string
        file_type:
          description: >-
            Indicates whether the file is a binary upload or a signed link to
            the document.
          type: string
          enum:
            - uri
            - binary
            - multipart
        file:
          oneOf:
            - type: string
              format: uri
              description: A signed URL to the file.
            - type: string
              description: A base64 encoded string of the file.
            - type: array
              description: A multipart file upload.
              items:
                type: object
                properties:
                  text:
                    type: string
                    description: The text content of the file.
                  file:
                    type: object
                    properties:
                      mimetype:
                        type: string
                        description: The MIME type of the file.
                      file_type:
                        description: >-
                          Indicates whether the file is a binary upload or a
                          signed link to the document.
                        type: string
                        enum:
                          - uri
                          - binary
                      content:
                        oneOf:
                          - type: string
                            description: The base64 encoded content of the file.
                          - type: string
                            format: uri
                            description: A signed URL to the file.
                    required:
                      - mimetype
                      - file_type
                      - content
      required:
        - file
        - mimetype
        - filename
        - file_type
    Error:
      type: object
      properties:
        errorMessage:
          type: string
      required:
        - errorMessage
  securitySchemes:
    api-key:
      type: apiKey
      in: header
      name: X-API-Key

````