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

# Create a File

> Creates a file, folder, or link record within a file channel. `channelID` is
required; `path` is required for folders and `linkUrl` for links. Files default
to "append" behavior (keep both, adding a numbered suffix) when a file with the
same name already exists at the path.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/files/{fileType}
openapi: 3.0.0
info:
  contact: {}
  title: Assembly API
  version: 0.0.1
servers:
  - url: https://api.assembly.com
security: []
paths:
  /v1/files/{fileType}:
    post:
      tags:
        - Files
      summary: Create a File
      description: >-
        Creates a file, folder, or link record within a file channel.
        `channelID` is

        required; `path` is required for folders and `linkUrl` for links. Files
        default

        to "append" behavior (keep both, adding a numbered suffix) when a file
        with the

        same name already exists at the path.
      operationId: create-file
      parameters:
        - description: >-
            The type of file object to be created. This can be 'file', 'folder',
            or 'link'.
          in: path
          name: fileType
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/files.CreateFileInput'
        description: File to create
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/files.File'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/dispatcher.Error'
          description: Invalid request body or field values
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/dispatcher.Error'
          description: Missing or invalid API key
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/dispatcher.Error'
          description: Unexpected server error
      security:
        - APIKeyHeader: []
components:
  schemas:
    files.CreateFileInput:
      properties:
        channelID:
          description: ChannelID is the file channel the item is created in.
          example: a8f2c1d4-1234-4abc-9def-0123456789ab
          type: string
        clientPermissions:
          description: >-
            ClientPermissions sets the folder locking permissions for the
            created file/folder
          enum:
            - read_write
            - read_only
          example: read_write
          type: string
        duplicateBehavior:
          allOf:
            - $ref: '#/components/schemas/files.DuplicateBehavior'
          description: >-
            DuplicateBehavior specifies how to handle if a file with the same
            name already exists at the path.

            Defaults to "append" (keep both) when omitted.
          enum:
            - append
            - replace
          example: append
        fileKey:
          description: >-
            FileKey is the S3 object key for an already-uploaded file's binary
            data.
          example: files/a8f2c1d4/2024-01-02T15:04:05Z/brochure.pdf
          type: string
        linkUrl:
          description: FileURL is the external link target. Required when creating a link.
          example: https://example.com/brochure.pdf
          format: uri
          type: string
        path:
          description: >-
            Path is the folder location for the item. Required when creating a
            folder.
          example: /contracts/2024
          type: string
        type:
          description: >-
            Type is the kind of item to create. Defaults to "file" when omitted
            on the path.
          enum:
            - file
            - folder
            - link
          example: file
          type: string
      required:
        - channelID
        - type
      type: object
    files.File:
      properties:
        additionalFields:
          $ref: '#/components/schemas/files.AdditionalFields'
        channelId:
          description: ChannelID is the file channel the item belongs to.
          example: a8f2c1d4-1234-4abc-9def-0123456789ab
          type: string
        clientPermissions:
          description: ClientPermissions controls client read/write access for folders.
          enum:
            - read_write
            - read_only
          example: read_write
          type: string
        createdAt:
          type: string
        creatorId:
          description: CreatorId is the id of the user who created the file.
          example: f4a1b2c3-1234-4abc-9def-0123456789ab
          type: string
        data:
          type: string
        downloadUrl:
          description: DownloadURL is a presigned URL for downloading the file's contents.
          format: uri
          type: string
        fields:
          allOf:
            - $ref: '#/components/schemas/files.Fields'
          description: Fields holds the item's name, path, link target, size, and status.
        id:
          type: string
        identityId:
          type: string
        lastModifiedBy:
          allOf:
            - $ref: '#/components/schemas/files.LastModifiedBy'
          description: LastModifiedBy identifies the user who last modified the file.
        object:
          type: string
        previousAttributes:
          additionalProperties: true
          type: object
        ref:
          type: string
        updatedAt:
          description: UpdatedDate is when the file was last updated.
          format: date-time
          type: string
        uploadUrl:
          description: >-
            UploadURL is a presigned URL for uploading the file's binary data,
            set on creation of an unuploaded file.
          format: uri
          type: string
      type: object
    dispatcher.Error:
      properties:
        code:
          type: string
        data: {}
        message:
          type: string
      type: object
    files.DuplicateBehavior:
      enum:
        - append
        - replace
      type: string
      x-enum-varnames:
        - DuplicateBehaviorAppend
        - DuplicateBehaviorReplace
    files.AdditionalFields:
      type: object
    files.Fields:
      properties:
        eSignatureStatus:
          allOf:
            - $ref: '#/components/schemas/constants.SignStatus'
          description: >-
            ESignatureStatus reflects the e-signature state when the file is
            part of a signing flow.
          enum:
            - pending
            - sent
            - done
          example: done
        linkUrl:
          description: FileUrl is the external link target, only set for link items.
          example: https://example.com/brochure.pdf
          format: uri
          type: string
        name:
          description: Name is the display name of the file, folder, or link.
          example: brochure.pdf
          type: string
        path:
          description: Path is the location of the item within its file channel.
          example: /contracts/2024
          type: string
        size:
          description: Size is the file size in bytes.
          example: 20480
          type: integer
        status:
          allOf:
            - $ref: '#/components/schemas/files.FileUploadStatus'
          description: >-
            Status indicates whether the file's binary data has finished
            uploading.
          enum:
            - pending
            - complete
          example: complete
      type: object
    files.LastModifiedBy:
      properties:
        id:
          description: Id is the id of the user who last modified the file.
          example: f4a1b2c3-1234-4abc-9def-0123456789ab
          type: string
        object:
          description: >-
            Object is the entity type of the modifier (e.g. internalUser,
            client).
          example: internalUser
          type: string
      type: object
    constants.SignStatus:
      enum:
        - pending
        - sent
        - done
      type: string
      x-enum-varnames:
        - FileEsigStatusSignPending
        - FileEsigStatusSignSent
        - FileEsigStatusSignDone
    files.FileUploadStatus:
      enum:
        - pending
        - complete
      type: string
      x-enum-varnames:
        - UploadPending
        - UploadComplete
  securitySchemes:
    APIKeyHeader:
      in: header
      name: X-API-KEY
      type: apiKey

````