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

# Upload File

> Upload file content for a pragma/file resource.

The file is stored in GCS and can be referenced by a pragma/file resource.
After uploading, apply the resource YAML to make it available:

```yaml
provider: pragma
resource: file
name: my-file
config:
  content_type: application/pdf
lifecycle_state: pending
```

Returns:
    FileMetadata with URL, size, checksum, and upload timestamp.

Raises:
    HTTPException: 413 if file exceeds maximum size.



## OpenAPI

````yaml https://api.pragmatiks.io/openapi.json post /files/{name}/upload
openapi: 3.1.0
info:
  title: Pragma API
  version: 0.1.0
servers: []
security: []
paths:
  /files/{name}/upload:
    post:
      tags:
        - files
      summary: Upload File
      description: >-
        Upload file content for a pragma/file resource.


        The file is stored in GCS and can be referenced by a pragma/file
        resource.

        After uploading, apply the resource YAML to make it available:


        ```yaml

        provider: pragma

        resource: file

        name: my-file

        config:
          content_type: application/pdf
        lifecycle_state: pending

        ```


        Returns:
            FileMetadata with URL, size, checksum, and upload timestamp.

        Raises:
            HTTPException: 413 if file exceeds maximum size.
      operationId: files-upload_file
      parameters:
        - name: name
          in: path
          required: true
          schema:
            type: string
            title: Name
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_files-upload_file'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileMetadata'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    Body_files-upload_file:
      properties:
        file:
          type: string
          contentMediaType: application/octet-stream
          title: File
      type: object
      required:
        - file
      title: Body_files-upload_file
    FileMetadata:
      properties:
        url:
          type: string
          title: Url
        public_url:
          type: string
          title: Public Url
        size:
          type: integer
          title: Size
        content_type:
          type: string
          title: Content Type
        checksum:
          type: string
          title: Checksum
        uploaded_at:
          type: string
          format: date-time
          title: Uploaded At
      type: object
      required:
        - url
        - public_url
        - size
        - content_type
        - checksum
        - uploaded_at
      title: FileMetadata
      description: Metadata for a stored file.
    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

````