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

# Create a new file resource



## OpenAPI

````yaml /openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/resources/file
openapi: 3.0.0
info:
  title: Brainbase REST API
  version: 1.0.3
  description: API documentation for Brainbase REST API
servers:
  - url: https://brainbase-monorepo-api.onrender.com
    description: Production server
security:
  - ApiKeyAuth: []
tags:
  - name: Team
    description: Endpoints related to team functionalities
  - name: Integrations
    description: Endpoints for integrations
  - name: Assets
    description: Endpoints for asset management
  - name: Workers
    description: Endpoints for worker operations
  - name: Flows
    description: Endpoints for flow management
  - name: Voice Deployments
    description: Endpoints for voice deployments
  - name: Voice V1 Deployments
    description: Endpoints for voice v1 deployments
  - name: Voice Deployment Logs
    description: Endpoints for voice deployment logs
  - name: Voice Deployment Outbound Data
    description: Endpoints for voice deployment outbound data
  - name: Chat Deployments
    description: Endpoints for chat deployments
  - name: Chat Deployment Logs
    description: Endpoints for chat deployment logs
  - name: Tags
    description: Endpoints for tag management and worker tag assignment
  - name: Echo
    description: Endpoints for Echo test suites, agents, and scorecards
  - name: Flow Versions
    description: Endpoints for flow version control
  - name: Deployment History
    description: Endpoints for deployment change history
  - name: Deployment Parameters
    description: Endpoints for deployment parameters
  - name: Log Exports
    description: Endpoints for async log export to CSV/JSON
  - name: Logs
    description: >-
      Universal log lookup — fetch any deployment log by ID without needing
      worker or deployment context
  - name: Deployments
    description: >-
      Universal deployment lookup — fetch any deployment by ID without needing
      worker context
paths:
  /api/workers/{workerId}/resources/file:
    post:
      tags:
        - File Resources
      summary: Create a new file resource
      parameters:
        - name: workerId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateFileResourceRequest'
      responses:
        '201':
          description: File resource created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RAGResource'
        '400':
          description: Invalid request body
        '401':
          description: Unauthorized
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import BrainbaseLabs from 'brainbase-labs';


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


            const resource = await
            client.workers.resources.file.create('workerId', {
              fileName: 'fileName',
              mimeType: 'mimeType',
              name: 'name',
              s3FilePath: 's3FilePath',
              size: 0,
            });


            console.log(resource.id);
        - lang: Python
          source: |-
            import os
            from brainbase_labs import BrainbaseLabs

            client = BrainbaseLabs(
                api_key=os.environ.get("BRAINBASE_LABS_API_KEY"),  # This is the default and can be omitted
            )
            resource = client.workers.resources.file.create(
                worker_id="workerId",
                file_name="fileName",
                mime_type="mimeType",
                name="name",
                s3_file_path="s3FilePath",
                size=0,
            )
            print(resource.id)
components:
  schemas:
    CreateFileResourceRequest:
      type: object
      properties:
        name:
          type: string
          nullable: false
        s3FilePath:
          type: string
          nullable: false
        fileName:
          type: string
          nullable: false
        mimeType:
          type: string
          nullable: false
        size:
          type: number
          nullable: false
        folderId:
          type: string
      required:
        - name
        - s3FilePath
        - fileName
        - mimeType
        - size
    RAGResource:
      type: object
      properties:
        id:
          type: string
          nullable: false
        ragType:
          $ref: '#/components/schemas/RagResourceType'
        lastUpdated:
          type: string
          nullable: true
          format: date-time
        updateFrequency:
          type: string
          nullable: true
        rawLink:
          type: string
          nullable: true
        key:
          type: string
          nullable: true
        s3FilePath:
          type: string
          nullable: true
        imageS3FilePath:
          type: string
          nullable: true
        signedS3FilePath:
          type: string
          nullable: true
        numScrolls:
          type: integer
          nullable: true
        fileName:
          type: string
          nullable: true
        mimeType:
          type: string
          nullable: true
        status:
          type: string
          enum:
            - STARTED
            - PROCESSING
            - FAILED
            - AVAILABLE
            - DELETED
        processingError:
          type: string
          nullable: true
        graphStatus:
          type: object
          nullable: true
        size:
          type: integer
          nullable: true
        uploadedAt:
          type: string
          nullable: true
          format: date-time
        folderId:
          type: string
          nullable: true
      required:
        - id
        - ragType
    RagResourceType:
      type: string
      enum:
        - FILE
        - WEBPAGE
        - SITEMAP
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API key authentication

````