> ## Documentation Index
> Fetch the complete documentation index at: https://e2b-automation-api-reference-update.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Compose multiple files into a single file using zero-copy concatenation. Source files are deleted after successful composition.



## OpenAPI

````yaml /openapi-public.yml post /files/compose
openapi: 3.1.0
info:
  title: E2B API
  version: 0.1.0
  description: >-
    Complete E2B developer API. Platform endpoints are served on api.e2b.app.
    Sandbox endpoints (envd) are served on the shared sandbox host
    (sandbox.e2b.app); target a specific sandbox with the E2b-Sandbox-Id and
    E2b-Sandbox-Port headers.
servers:
  - url: https://api.e2b.app
    description: E2B Platform API
security: []
tags:
  - name: Sandboxes
  - name: Templates
  - name: Tags
  - name: Volumes
  - name: Envd
  - name: Filesystem
  - name: Process
  - name: Teams
paths:
  /files/compose:
    servers:
      - url: https://sandbox.{domain}
        description: Sandbox API (envd) - runs inside each sandbox
        variables:
          domain:
            default: e2b.app
            description: E2B domain
    post:
      tags:
        - Filesystem
      summary: >-
        Compose multiple files into a single file using zero-copy concatenation.
        Source files are deleted after successful composition.
      operationId: postFilesCompose
      parameters:
        - name: E2b-Sandbox-Id
          in: header
          required: true
          description: >-
            Identifier of the target sandbox. Routes the request to that
            sandbox's envd over the shared sandbox host.
          schema:
            type: string
        - name: E2b-Sandbox-Port
          in: header
          required: true
          description: Port envd listens on inside the sandbox (default 49983).
          schema:
            type: integer
            default: 49983
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ComposeRequest'
      responses:
        '200':
          description: Files composed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EntryInfo'
        '400':
          $ref: '#/components/responses/InvalidPath'
        '401':
          $ref: '#/components/responses/InvalidUser'
        '404':
          $ref: '#/components/responses/FileNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '502':
          description: Sandbox not found
          content:
            application/json:
              schema:
                type: object
                required:
                  - sandboxID
                  - message
                  - code
                properties:
                  message:
                    type: string
                    description: Error message
                  code:
                    type: integer
                    description: Error code
                  sandboxID:
                    type: string
                    description: Identifier of the sandbox
        '507':
          $ref: '#/components/responses/NotEnoughDiskSpace'
      security:
        - SandboxAccessTokenAuth: []
components:
  schemas:
    ComposeRequest:
      type: object
      required:
        - source_paths
        - destination
      properties:
        source_paths:
          type: array
          items:
            type: string
          description: Ordered list of source file paths to concatenate
        destination:
          type: string
          description: Destination file path for the composed file
        username:
          type: string
          description: User for setting ownership and resolving relative paths
    EntryInfo:
      required:
        - path
        - name
        - type
      properties:
        path:
          type: string
          description: Path to the file
        name:
          type: string
          description: Name of the file
        type:
          type: string
          description: Type of the file
          enum:
            - file
            - directory
        metadata:
          type: object
          description: User-defined metadata stored as extended attributes on the file.
          additionalProperties:
            type: string
      type: object
    Error:
      required:
        - code
        - message
      properties:
        code:
          type: integer
          format: int32
          description: Error code
        message:
          type: string
          description: Error
      type: object
  responses:
    InvalidPath:
      description: Invalid path
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            message: path '/home/user/docs' is a directory
            code: 400
    InvalidUser:
      description: Invalid user
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            message: >-
              error looking up user 'nonexistent': user: unknown user
              nonexistent
            code: 401
    FileNotFound:
      description: File not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            message: path '/home/user/missing.txt' does not exist
            code: 404
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            message: 'error opening file ''/home/user/file.txt'': permission denied'
            code: 500
    NotEnoughDiskSpace:
      description: Not enough disk space
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            message: not enough disk space available
            code: 507
  securitySchemes:
    SandboxAccessTokenAuth:
      type: apiKey
      in: header
      name: X-Access-Token
      description: >-
        Sandbox access token (`envdAccessToken`) for authenticating requests to
        a running sandbox. Returned by: [POST
        /sandboxes](/docs/api-reference/sandboxes/create-a-sandbox) (on create),
        [POST
        /sandboxes/{sandboxID}/connect](/docs/api-reference/sandboxes/connect-to-a-sandbox)
        (on connect), [POST
        /sandboxes/{sandboxID}/resume](/docs/api-reference/sandboxes/resume-a-sandbox)
        (on resume), and [GET
        /sandboxes/{sandboxID}](/docs/api-reference/sandboxes/get-a-sandbox)
        (for running or paused sandboxes).

````