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

# Upload file bytes directly

> Upload a file's bytes directly and create a file record.

Send the file as multipart/form-data in the ``file`` field; the request body
carries the raw bytes, unlike cloud_imports which only references blobs that
already exist in cloud storage. The upload is rejected if it exceeds 25 MB;
larger or direct-to-storage uploads use a separate upload flow. The server
detects the content type from the bytes and rejects content that fails the
structural validation for that type. Content is deduplicated by checksum
and MIME type, so uploading bytes identical to an existing file reuses the
already-stored object instead of storing a second copy. Returns the created
file's metadata.



## OpenAPI

````yaml /openapi/v4.yaml post /v4/beta/files
openapi: 3.1.0
info:
  title: EGP API V4
  description: >-
    This is the parent API for all EGP APIs. If you are looking for the EGP API,
    please go to https://api.egp.scale.com/docs.
  contact:
    name: Scale Generative AI Platform
    url: https://scale.com/genai-platform
  version: 0.1.0
servers:
  - url: https://api.egp.scale.com
security: []
tags:
  - name: Models
    description: Model API.
paths:
  /v4/beta/files:
    post:
      tags:
        - Beta
      summary: Upload file bytes directly
      description: >-
        Upload a file's bytes directly and create a file record.


        Send the file as multipart/form-data in the ``file`` field; the request
        body

        carries the raw bytes, unlike cloud_imports which only references blobs
        that

        already exist in cloud storage. The upload is rejected if it exceeds 25
        MB;

        larger or direct-to-storage uploads use a separate upload flow. The
        server

        detects the content type from the bytes and rejects content that fails
        the

        structural validation for that type. Content is deduplicated by checksum

        and MIME type, so uploading bytes identical to an existing file reuses
        the

        already-stored object instead of storing a second copy. Returns the
        created

        file's metadata.
      operationId: POST-V4-beta-/files
      parameters:
        - name: x-selected-account-id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Account ID Header
        - name: x-project-id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Project ID Header
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_POST-V4-beta-_files'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/File'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    Body_POST-V4-beta-_files:
      properties:
        file:
          type: string
          contentMediaType: application/octet-stream
          title: File
      type: object
      required:
        - file
      title: Body_POST-V4-beta-/files
    File:
      properties:
        id:
          type: string
          title: Id
          description: The unique identifier of the entity.
        object:
          type: string
          const: file
          title: Object
          default: file
        size:
          type: integer
          title: Size
        md5_checksum:
          type: string
          title: Md5 Checksum
        filename:
          type: string
          title: Filename
        mime_type:
          type: string
          title: Mime Type
        tags:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Tags
        duration_seconds:
          anyOf:
            - type: integer
            - type: 'null'
          title: Duration Seconds
        created_at:
          type: string
          format: date-time
          title: Created At
          description: The date and time when the entity was created in ISO format.
        created_by:
          $ref: '#/components/schemas/Identity'
          description: The identity that created the entity.
      type: object
      required:
        - size
        - md5_checksum
        - filename
        - mime_type
        - id
        - created_at
        - created_by
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    Identity:
      properties:
        id:
          type: string
          title: Id
        object:
          type: string
          const: identity
          title: Object
          default: identity
        type:
          $ref: '#/components/schemas/IdentityType'
      type: object
      required:
        - id
        - type
      title: Identity
    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
          additionalProperties: true
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    IdentityType:
      type: string
      enum:
        - user
        - service_account
      title: IdentityType
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: x-api-key

````