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

# Init Upload

> Start a file upload and get a signed URL to PUT the bytes to.

This call does not carry the file itself. It returns a `signed_url`, the
`required_headers` you must send with it, an `expires_at`, and the `max_size_bytes`
ceiling. Upload the bytes directly to that URL, then poll
`GET /v1/files/{file_id}` for the status.

With `embed` true (the default) the file is chunked and embedded once the bytes
land, which makes it searchable through `POST /v1/files/search`. Any `metadata` you
pass is stored per chunk and can be filtered on at search time.

Accepted types: any `text/*`, PDF, DOC/DOCX, XLS/XLSX, PPTX, JSON, XML, SQL.
Anything else is a 422 here, before you spend bandwidth on the upload.

`text/*` is taken at face value: a text subtype with no dedicated parser — `text/rtf`
is the one to watch — is chunked exactly as sent, so its markup ends up in the
embeddings alongside the prose and dilutes search results. Convert such files to
plain text or PDF before uploading.



## OpenAPI

````yaml /api/openapi.json post /v1/files
openapi: 3.1.0
info:
  title: MeshAPI
  description: One key, all AI models.
  version: 0.1.0
servers:
  - url: https://api.meshapi.ai
security:
  - BearerAuth: []
paths:
  /v1/files:
    post:
      tags:
        - RAG
      summary: Init Upload
      description: >-
        Start a file upload and get a signed URL to PUT the bytes to.


        This call does not carry the file itself. It returns a `signed_url`, the

        `required_headers` you must send with it, an `expires_at`, and the
        `max_size_bytes`

        ceiling. Upload the bytes directly to that URL, then poll

        `GET /v1/files/{file_id}` for the status.


        With `embed` true (the default) the file is chunked and embedded once
        the bytes

        land, which makes it searchable through `POST /v1/files/search`. Any
        `metadata` you

        pass is stored per chunk and can be filtered on at search time.


        Accepted types: any `text/*`, PDF, DOC/DOCX, XLS/XLSX, PPTX, JSON, XML,
        SQL.

        Anything else is a 422 here, before you spend bandwidth on the upload.


        `text/*` is taken at face value: a text subtype with no dedicated parser
        — `text/rtf`

        is the one to watch — is chunked exactly as sent, so its markup ends up
        in the

        embeddings alongside the prose and dilutes search results. Convert such
        files to

        plain text or PDF before uploading.
      operationId: init_upload
      parameters:
        - in: header
          name: X-Mesh-Version
          required: false
          schema:
            type: string
            enum:
              - 2026-08
            default: 2026-08
          example: 2026-08
          description: >-
            Dated version of the API contract to pin this request to. Omit it
            and the request is served under `2026-08` — the oldest supported
            version, so an existing integration is never moved by a release. A
            malformed or unsupported value is rejected with `400
            invalid_api_version` rather than falling back silently. The version
            actually served is echoed as `X-Mesh-Version` on every response,
            including errors.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InitUploadRequest'
            examples:
              default:
                summary: Example request
                value:
                  file_name: project_proposal.pdf
                  mime_type: application/pdf
                  embed: true
                  metadata:
                    source: docs
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InitUploadResponse'
              examples:
                default:
                  summary: Example response
                  value:
                    file_id: file_01JZ0S3N6M8ZQ8DGK9VY1R2H3T
                    signed_url: >-
                      https://storage.googleapis.com/meshapi-uploads/project_proposal.pdf?X-Goog-Signature=...
                    expires_at: '2026-07-02T10:30:30Z'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    InitUploadRequest:
      properties:
        file_name:
          type: string
          title: File Name
        mime_type:
          type: string
          title: Mime Type
        embed:
          type: boolean
          title: Embed
          default: true
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
      type: object
      required:
        - file_name
        - mime_type
      title: InitUploadRequest
      example:
        file_name: project_proposal.pdf
        mime_type: application/pdf
    InitUploadResponse:
      properties:
        file_id:
          type: string
          title: File Id
        signed_url:
          type: string
          title: Signed Url
        expires_at:
          type: string
          format: date-time
          title: Expires At
        required_headers:
          additionalProperties:
            type: string
          type: object
          title: Required Headers
        max_size_bytes:
          type: integer
          title: Max Size Bytes
          default: 31457280
      type: object
      required:
        - file_id
        - signed_url
        - expires_at
      title: InitUploadResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Enter your MeshAPI key (`rsk_...`) — sent as `Authorization: Bearer
        <key>`.

````