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

# Initiate a file upload

> <p>Create a pending file and get a signed URL to PUT the bytes to.</p>



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/indices/openapi.documented.yml post /v1beta/files
openapi: 3.1.0
info:
  title: Indices API
  description: 'The Indices REST API. See docs for details: https://docs.indices.io'
  version: 0.0.1
servers:
  - url: https://api.indices.io
security:
  - ApiKeyAuth: []
tags:
  - name: Capture Sessions
    description: >-
      Record a browser session; a completed capture is a reusable input for
      building connectors.
  - name: Connectors
    description: Manage connectors.
  - name: Runs
    description: Execute a connector.
  - name: Secrets
    description: Manage secrets like login credentials and API keys.
paths:
  /v1beta/files:
    post:
      tags:
        - Files
      summary: Initiate a file upload
      description: <p>Create a pending file and get a signed URL to PUT the bytes to.</p>
      operationId: initiateFileUpload
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InitiateFileUploadRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InitiateFileUploadResponse'
        '422':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Indices from 'indicesio';

            const client = new Indices({
              apiKey: process.env['INDICES_API_KEY'], // This is the default and can be omitted
            });

            const file = await client.beta.files.create({
              content_type: 'x',
              name: 'x',
              size_bytes: 0,
            });

            console.log(file.file_id);
        - lang: Python
          source: |-
            import os
            from indices import Indices

            client = Indices(
                api_key=os.environ.get("INDICES_API_KEY"),  # This is the default and can be omitted
            )
            file = client.beta.files.create(
                content_type="x",
                name="x",
                size_bytes=0,
            )
            print(file.file_id)
components:
  schemas:
    InitiateFileUploadRequest:
      properties:
        name:
          type: string
          maxLength: 512
          minLength: 1
          description: User-facing filename, e.g. 'report.pdf'.
        size_bytes:
          type: integer
          minimum: 0
          description: Exact size of the file in bytes. Enforced by the signed upload URL.
        content_type:
          type: string
          maxLength: 256
          minLength: 1
          description: MIME type of the file content.
      type: object
      required:
        - name
        - size_bytes
        - content_type
      title: InitiateFileUploadRequest
    InitiateFileUploadResponse:
      properties:
        file_id:
          type: string
          description: Server-assigned ID of the pending file.
        upload_url:
          type: string
          description: Signed URL the sandbox must PUT the file bytes to.
        upload_headers:
          additionalProperties:
            type: string
          type: object
          description: >-
            Headers that must be sent verbatim with the PUT; they are covered by
            the URL signature.
        expires_at:
          type: string
          format: date-time
          description: When the upload URL stops being valid.
      type: object
      required:
        - file_id
        - upload_url
        - upload_headers
        - expires_at
      title: InitiateFileUploadResponse
    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:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        Enter your API key as the bearer token. Set header: `Authorization` to
        `Bearer <api_key>`

````