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

# Upload file

> Uploads a file and returns a temporary URL for model inputs.



## OpenAPI

````yaml /hub/openapi/hub.json post /api/v1/hub/files
openapi: 3.0.1
info:
  title: Fanify Hub API
  description: Generate media and text with Fanify credits. All prices use EUR.
  version: v1
servers:
  - url: https://fanifyai.com
security: []
paths:
  /api/v1/hub/files:
    post:
      tags:
        - Files
      summary: Upload file
      description: Uploads a file and returns a temporary URL for model inputs.
      requestBody:
        description: >-
          File upload (maximum 50 MiB by default; the service configuration can
          lower this limit).
        content:
          multipart/form-data:
            schema:
              required:
                - file
              type: object
              properties:
                file:
                  type: string
                  format: binary
        required: true
      responses:
        '201':
          description: Uploaded file.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubFileDto'
              example:
                id: 8Jd2kQ7pR1sT4uV6wX9yZ0aB2cD4eF6gH8iJ0kL2mN4
                url: >-
                  https://fanifyai.com/api/v1/hub/files/8Jd2kQ7pR1sT4uV6wX9yZ0aB2cD4eF6gH8iJ0kL2mN4
                sha256: >-
                  e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
                size: 812345
                media_type: image/png
                expires_at: '2026-09-08T10:00:00Z'
        '400':
          description: Invalid input
          content:
            application/problem+json:
              schema:
                required:
                  - type
                  - title
                  - status
                  - code
                type: object
                properties:
                  type:
                    type: string
                    format: uri
                  title:
                    type: string
                  status:
                    type: integer
                    format: int32
                  detail:
                    type: string
                    nullable: true
                  instance:
                    type: string
                  code:
                    enum:
                      - invalid_input
                    type: string
                  errors:
                    type: object
                    additionalProperties:
                      type: array
                      items:
                        type: string
                  unrepresentable:
                    type: array
                    items:
                      type: string
              example:
                type: https://fanifyai.com/docs/hub/errors#invalid_input
                title: Invalid input
                status: 400
                code: invalid_input
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                required:
                  - type
                  - title
                  - status
                  - code
                type: object
                properties:
                  type:
                    type: string
                    format: uri
                  title:
                    type: string
                  status:
                    type: integer
                    format: int32
                  detail:
                    type: string
                    nullable: true
                  instance:
                    type: string
                  code:
                    enum:
                      - unauthorized
                    type: string
                  errors:
                    type: object
                    additionalProperties:
                      type: array
                      items:
                        type: string
                  unrepresentable:
                    type: array
                    items:
                      type: string
              example:
                type: https://fanifyai.com/docs/hub/errors#unauthorized
                title: Unauthorized
                status: 401
                code: unauthorized
        '413':
          description: Payload too large
          content:
            application/problem+json:
              schema:
                required:
                  - type
                  - title
                  - status
                  - code
                type: object
                properties:
                  type:
                    type: string
                    format: uri
                  title:
                    type: string
                  status:
                    type: integer
                    format: int32
                  detail:
                    type: string
                    nullable: true
                  instance:
                    type: string
                  code:
                    enum:
                      - payload_too_large
                    type: string
                  errors:
                    type: object
                    additionalProperties:
                      type: array
                      items:
                        type: string
                  unrepresentable:
                    type: array
                    items:
                      type: string
              example:
                type: https://fanifyai.com/docs/hub/errors#payload_too_large
                title: Payload too large
                status: 413
                code: payload_too_large
        '429':
          description: Rate limit reached
          headers:
            Retry-After:
              description: Seconds before retrying.
              schema:
                type: string
          content:
            application/problem+json:
              schema:
                required:
                  - type
                  - title
                  - status
                  - code
                type: object
                properties:
                  type:
                    type: string
                    format: uri
                  title:
                    type: string
                  status:
                    type: integer
                    format: int32
                  detail:
                    type: string
                    nullable: true
                  instance:
                    type: string
                  code:
                    enum:
                      - rate_limited
                    type: string
                  errors:
                    type: object
                    additionalProperties:
                      type: array
                      items:
                        type: string
                  unrepresentable:
                    type: array
                    items:
                      type: string
              example:
                type: https://fanifyai.com/docs/hub/errors#rate_limited
                title: Rate limit reached
                status: 429
                code: rate_limited
      security:
        - Bearer: []
components:
  schemas:
    HubFileDto:
      required:
        - expires_at
        - id
        - media_type
        - sha256
        - size
        - url
      type: object
      properties:
        id:
          type: string
        url:
          type: string
        sha256:
          type: string
        size:
          type: integer
          format: int64
        media_type:
          type: string
        expires_at:
          type: string
          format: date-time
      additionalProperties: false
  securitySchemes:
    Bearer:
      type: http
      description: Fanify API key.
      scheme: bearer
      bearerFormat: fanify_sk_...

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.