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

# Upload file

> Upload a local file to Rapid's S3 Bucket.



## OpenAPI

````yaml post /api/files/file
openapi: 3.1.0
info:
  title: Nx1 AI API
  description: |

    AI API for Nx1 Data Platform Management and Automated Data Tasks.

    Authentication is required via PSK in Authorization header.

    Default PSK is | [ask a friend] |
  version: 0.10.2
servers: []
security: []
paths:
  /api/files/file:
    post:
      tags:
        - Files
      summary: Upload file
      description: Upload a local file to Rapid's S3 Bucket.
      operationId: upload_file_api_files_file_post
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_upload_file_api_files_file_post'
      responses:
        '201':
          description: File uploaded successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileModel'
        '400':
          description: Bad request. Provide `file`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - OAuth2AuthorizationCodeBearer: []
        - APIKeyHeader: []
components:
  schemas:
    Body_upload_file_api_files_file_post:
      properties:
        file:
          anyOf:
            - type: string
              contentMediaType: application/octet-stream
            - type: 'null'
          title: File
          description: The file to upload.
      type: object
      title: Body_upload_file_api_files_file_post
    FileModel:
      properties:
        id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Id
          description: Unique ID for the file.
        owner_id:
          type: string
          title: Owner Id
          description: The logged in user's email ID.
        name:
          type: string
          title: Name
          description: Name of the uploaded file.
        bucket_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Bucket Name
          description: Name of the S3 bucket that stores this file.
        source_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Url
          description: URL from which the file was originally uploaded.
        s3_url:
          anyOf:
            - type: string
            - type: 'null'
          title: S3 Url
          description: S3 URL of the uploaded file.
        size:
          type: integer
          title: Size
          description: Size of the file in bytes.
        access_count:
          type: integer
          title: Access Count
          description: Number of times you accessed the file.
          default: 0
        created_at:
          type: string
          format: date-time
          title: Created At
          description: Timestamp of the upload.
        accessed_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Accessed At
          description: Timestamp when the file was last accessed.
      type: object
      required:
        - owner_id
        - name
        - size
      title: FileModel
    ErrorResponse:
      properties:
        error:
          type: string
          title: Error
          description: A brief description of the error that occurred.
        code:
          type: integer
          title: Code
          description: The HTTP status code associated with the error.
          default: 500
      type: object
      required:
        - error
      title: ErrorResponse
    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:
    OAuth2AuthorizationCodeBearer:
      type: oauth2
      flows:
        authorizationCode:
          scopes: {}
          authorizationUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/auth
          tokenUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/token
    APIKeyHeader:
      type: apiKey
      in: header
      name: Authorization-PSK

````