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

# Create a File

> Add a new file to a silo entry without an explicit UUID. The file data can be provided inline as base64 encoded data, or omitted to create a placeholder. When data is not provided, you must provide sha256, size, and mime fields, and the response will include a `url` field that can be used to stream/upload the file contents directly via a PUT request to that URL. For non enrolled users, only the `format` and `attachment` categories are allowed.



## OpenAPI

````yaml POST /silo/v1/entries/{entry_id}/files
openapi: 3.0.0
info:
  contact:
    email: dev@invopop.com
    name: Invopop Developers
  description: >-
    Store and manage GOBL documents along with their attachments in "Silo
    Entries".
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  title: Silo Service API
  version: 1.0.0
servers:
  - description: production
    url: https://api.invopop.com
security:
  - authToken: []
paths:
  /silo/v1/entries/{entry_id}/files:
    post:
      description: >-
        Add a new file to a silo entry without an explicit UUID. The file data
        can be provided inline as base64 encoded data, or omitted to create a
        placeholder. When data is not provided, you must provide sha256, size,
        and mime fields, and the response will include a `url` field that can be
        used to stream/upload the file contents directly via a PUT request to
        that URL. For non enrolled users, only the `format` and `attachment`
        categories are allowed.
      parameters:
        - description: UUID of the silo entry.
          in: path
          name: entry_id
          required: true
          schema:
            description: UUID of the silo entry.
            title: Entry ID
            type: string
      requestBody:
        content:
          application/json:
            schema:
              properties:
                category:
                  description: Category of the file.
                  example: format
                  title: Category
                  type: string
                data:
                  description: >-
                    Base64 encoded binary data. Optional - if not provided,
                    sha256, size, and mime are required.
                  format: byte
                  type: string
                desc:
                  description: Description of the file.
                  example: Invoice for January 2021.
                  title: Description
                  type: string
                embeddable:
                  description: >-
                    When true, this file may be embedded inside other files,
                    like PDFs. Default is false.
                  example: true
                  title: Embeddable
                  type: boolean
                key:
                  description: Key used to identify the file in the entry.
                  example: pdf
                  title: Key
                  type: string
                meta:
                  additionalProperties:
                    type: string
                  description: Any additional meta data about the file.
                  title: Meta
                  type: object
                mime:
                  description: MIME type of the file. Required when data is not provided.
                  example: application/pdf
                  title: MIME
                  type: string
                name:
                  description: Name of the file.
                  example: invoice.pdf
                  title: Name
                  type: string
                private:
                  description: >-
                    When true, this file is private and can only be accessed by
                    the owner. Default is false.
                  example: true
                  title: Private
                  type: boolean
                sha256:
                  description: >-
                    SHA256 hex hash of the file. Required when data is not
                    provided.
                  example: >-
                    27a0b656df99dc32124b4c49f2f3c35025f0a7453f289cbaa0701435cfcf4e28
                  title: SHA256
                  type: string
                size:
                  description: >-
                    Size of the file in bytes. Required when data is not
                    provided.
                  example: 12345
                  title: Size
                  type: integer
              required:
                - name
              type: object
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SiloFile'
          description: OK
components:
  schemas:
    SiloFile:
      properties:
        category:
          description: Category of the file.
          example: version
          title: Category
          type: string
        created_at:
          description: The date and time this file was created.
          example: '2018-01-01T00:00:00.000Z'
          title: Created At
          type: string
        desc:
          description: Description of the file.
          example: Invoice for January 2021.
          title: Description
          type: string
        embeddable:
          description: When true, the file can be embedded inside another file, like a PDF.
          example: true
          title: Embeddable
          type: boolean
        entry_id:
          description: The UUID of the entry this file belongs to.
          example: 347c5b04-cde2-11ed-afa1-0242ac120002
          title: Entry ID
          type: string
        hash:
          description: SHA256 hash of the file.
          example: a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5z6
          title: Hash
          type: string
        id:
          description: The UUID that identifies the file in the entry.
          title: ID
          type: string
        key:
          description: >-
            Key used to identify the file by the service or app that generated
            it.
          example: pdf
          title: Key
          type: string
        meta:
          additionalProperties:
            type: string
          description: Any additional meta data about the file.
          title: Meta
          type: object
        mime:
          description: MIME type of the file.
          example: application/pdf
          title: MIME
          type: string
        name:
          description: Name of the file.
          example: invoice.pdf
          title: Name
          type: string
        previous:
          description: Set of previous versions of the file.
          items:
            $ref: '#/components/schemas/SiloFileVersion'
          title: Previous
          type: array
        private:
          description: When true, the file will not have a public link.
          title: Private
          type: boolean
        size:
          description: Size of the file in bytes.
          example: 12345
          title: Size
          type: integer
        stored:
          description: >-
            When true, indicates that the file's contents have been uploaded
            successfully.
          example: true
          title: Stored
          type: boolean
        url:
          description: URL where the file's contents can be downloaded.
          title: Public URL
          type: string
      type: object
    SiloFileVersion:
      properties:
        created_at:
          description: The date and time this file was created.
          example: '2018-01-01T00:00:00.000Z'
          title: Created At
          type: string
        hash:
          description: The SHA256 of the file's contents.
          title: Hash
          type: string
        id:
          description: The UUID that identifies the file when it was originally uploaded.
          title: ID
          type: string
        size:
          description: Size of the file.
          title: Size
          type: integer
      type: object
  securitySchemes:
    authToken:
      bearerFormat: JWT
      description: >-
        Use the `Bearer` scheme with a valid JWT token to authenticate requests.
        Example: `Authorization: Bearer <token>`
      scheme: bearer
      type: http

````