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

# Download File Content

> Stream a file's bytes at /v1/files/{file_id}/content

## Overview

Streams the file as `application/octet-stream`, one JSON object per line. For a batch's `output_file_id` every line is a [`BatchOutputLine`](/sdk/components/batch#output-file-format); for its `error_file_id` every line is a [`BatchErrorLine`](/sdk/components/batch#error-file-format). Lines are not in input order, so join them to your requests on `custom_id`.


## OpenAPI

````yaml GET /v1/files/{file_id}/content
openapi: 3.1.0
info:
  title: Morph API
  version: 1.2.0
  description: >-
    The Morph public API at api.morphllm.com: OpenAI- and Anthropic-compatible
    inference (chat completions, messages), the Batch API, Fast Apply code
    editing, Compact context compression, Reflex classification, and
    fine-tuning. Model ids, prices, and context windows are served live at
    https://www.morphllm.com/api/models/json.
  contact:
    name: Morph
    url: https://morphllm.com
    email: info@morphllm.com
  license:
    name: Proprietary
    url: https://morphllm.com/privacy/tos
servers:
  - url: https://api.morphllm.com
    description: Production
security: []
tags:
  - name: chat
    description: >-
      OpenAI- and Anthropic-compatible chat inference, including Fast Apply and
      WarpGrep models.
  - name: compact
    description: Context compression for long agent conversations.
  - name: reflex
    description: 'Per-turn classifiers: realtime prediction and batches.'
  - name: fine-tuning
    description: Reflex fine-tuning job lifecycle.
  - name: batch
    description: >-
      OpenAI-compatible Batch API: upload a JSONL file, run it at half price,
      download the results.
  - name: models
    description: Model listing and management.
  - name: telemetry
    description: Usage reporting hooks.
paths:
  /v1/files/{file_id}/content:
    get:
      tags:
        - batch
      summary: Download file content
      description: >-
        Stream a file's bytes. For a batch output file every line is a
        `BatchOutputLine`; for an error file every line is a `BatchErrorLine`;
        for an input file you uploaded, every line is a `BatchInputLine`. Lines
        are not in input order, so join on `custom_id`. Served as
        `application/octet-stream` with a `Content-Disposition` attachment
        header.
      operationId: getFileContent
      parameters:
        - schema:
            type: string
            description: >-
              The `file_` prefixed id to download: your upload, or a batch's
              `output_file_id` / `error_file_id`.
            example: file_9c2c1c3e-5b6a-4f0e-8d0f-2a1b3c4d5e6f
          required: true
          description: Identifies the file to download.
          name: file_id
          in: path
      responses:
        '200':
          description: The file body, one JSON object per line.
          content:
            application/octet-stream:
              example:
                id: batch_req_1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d
                custom_id: req-0001
                response:
                  status_code: 200
                  request_id: req_3f9a2c1b7d
                  body:
                    id: chatcmpl-7d2f1c3a9b
                    object: chat.completion
                    created: 1780005400
                    model: morph-glm53flash
                    choices:
                      - index: 0
                        message:
                          role: assistant
                          content: >-
                            Renames the auth helper and adds a null check on the
                            token.
                        finish_reason: stop
                    usage:
                      prompt_tokens: 412
                      completion_tokens: 18
                      total_tokens: 430
                error: null
              schema:
                anyOf:
                  - $ref: '#/components/schemas/BatchOutputLine'
                  - $ref: '#/components/schemas/BatchErrorLine'
                  - $ref: '#/components/schemas/BatchInputLine'
                description: >-
                  The shape of each JSONL line, depending on which file you
                  downloaded.
                example:
                  id: batch_req_1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d
                  custom_id: req-0001
                  response:
                    status_code: 200
                    request_id: req_3f9a2c1b7d
                    body:
                      id: chatcmpl-7d2f1c3a9b
                      object: chat.completion
                      created: 1780005400
                      model: morph-glm53flash
                      choices:
                        - index: 0
                          message:
                            role: assistant
                            content: >-
                              Renames the auth helper and adds a null check on
                              the token.
                          finish_reason: stop
                      usage:
                        prompt_tokens: 412
                        completion_tokens: 18
                        total_tokens: 430
                  error: null
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - bearerAuth: []
components:
  schemas:
    BatchOutputLine:
      type: object
      properties:
        id:
          type: string
          description: Server-assigned id for this request, `batch_req_` prefixed.
          example: batch_req_1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d
        custom_id:
          type: string
          description: The `custom_id` from your input line.
          example: req-0001
        response:
          type: object
          properties:
            status_code:
              type: integer
              description: >-
                HTTP status the model returned for this request. Non-2xx
                responses land here too, with the error body in `body`, and
                count toward `request_counts.failed`.
              example: 200
            request_id:
              type: string
              description: Inference request id, for support lookups.
              example: req_3f9a2c1b7d
            body:
              type: object
              additionalProperties: true
              description: >-
                The full Chat Completions response, identical to the synchronous
                endpoint, including `usage`. For a non-2xx `status_code` this is
                the error envelope instead.
              example:
                id: chatcmpl-7d2f1c3a9b
                object: chat.completion
                created: 1780005400
                model: morph-glm53flash
                choices:
                  - index: 0
                    message:
                      role: assistant
                      content: >-
                        Renames the auth helper and adds a null check on the
                        token.
                    finish_reason: stop
                usage:
                  prompt_tokens: 412
                  completion_tokens: 18
                  total_tokens: 430
          required:
            - status_code
            - request_id
            - body
          description: What the model returned.
          example:
            status_code: 200
            request_id: req_3f9a2c1b7d
            body:
              id: chatcmpl-7d2f1c3a9b
              object: chat.completion
              created: 1780005400
              model: morph-glm53flash
              choices:
                - index: 0
                  message:
                    role: assistant
                    content: >-
                      Renames the auth helper and adds a null check on the
                      token.
                  finish_reason: stop
              usage:
                prompt_tokens: 412
                completion_tokens: 18
                total_tokens: 430
        error:
          type: 'null'
          description: >-
            Always `null` in the output file. Client-side failures go to the
            error file instead.
          example: null
      required:
        - id
        - custom_id
        - response
        - error
      description: >-
        One line of the output file. Written for every request the model
        answered, whether the status was 200 or an error.
      example:
        id: batch_req_1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d
        custom_id: req-0001
        response:
          status_code: 200
          request_id: req_3f9a2c1b7d
          body:
            id: chatcmpl-7d2f1c3a9b
            object: chat.completion
            created: 1780005400
            model: morph-glm53flash
            choices:
              - index: 0
                message:
                  role: assistant
                  content: Renames the auth helper and adds a null check on the token.
                finish_reason: stop
            usage:
              prompt_tokens: 412
              completion_tokens: 18
              total_tokens: 430
        error: null
    BatchErrorLine:
      type: object
      properties:
        id:
          type: string
          description: Server-assigned id of the skipped request, `batch_req_` prefixed.
          example: batch_req_1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d
        custom_id:
          type: string
          description: Your `custom_id` for the skipped request.
          example: req-0002
        response:
          type: 'null'
          description: >-
            Always `null` in the error file: the request never reached the
            model, or never returned.
          example: null
        error:
          type: object
          properties:
            code:
              type: string
              description: >-
                Why the request was not executed: `timeout`, `batch_cancelled`,
                `batch_expired`, `batch_failed`, `model_not_found`, or
                `parse_error`.
              example: batch_expired
            message:
              type: string
              description: Human-readable detail.
              example: >-
                This request could not be executed before the completion window
                expired.
          required:
            - code
            - message
          description: The client-side failure.
          example:
            code: batch_expired
            message: >-
              This request could not be executed before the completion window
              expired.
      required:
        - id
        - custom_id
        - response
        - error
      description: >-
        One line of the error file. Only requests that never got a model
        response land here; a model error response is an output line with a
        non-2xx `status_code`.
      example:
        id: batch_req_1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d
        custom_id: req-0002
        response: null
        error:
          code: batch_expired
          message: >-
            This request could not be executed before the completion window
            expired.
    BatchInputLine:
      type: object
      properties:
        custom_id:
          type: string
          description: >-
            Your correlation key. Must be unique within the batch; echoed on the
            matching output or error line.
          example: req-0001
        method:
          type: string
          enum:
            - POST
          description: HTTP method. Always `POST`.
          example: POST
        url:
          type: string
          enum:
            - /v1/chat/completions
          description: >-
            Must match the batch `endpoint`. Only `/v1/chat/completions` is
            supported.
          example: /v1/chat/completions
        body:
          type: object
          properties:
            model:
              type: string
              description: >-
                One of `morph-glm53flash`, `morph-dsv4flash`,
                `morph-glm53-744b`, `morph-kimik3`. Every line in a batch must
                name the same model.
              example: morph-glm53flash
            messages:
              type: array
              items:
                type: object
                properties:
                  role:
                    type: string
                    description: 'Message author: `system`, `user`, `assistant`, or `tool`.'
                    example: user
                  content:
                    type: string
                    description: Message text.
                    example: 'Summarize this diff in one sentence: ...'
                required:
                  - role
                  - content
              description: >-
                The conversation, exactly as you would send it to the
                synchronous endpoint.
              example:
                - role: user
                  content: 'Summarize this diff in one sentence: ...'
          required:
            - model
            - messages
          additionalProperties: true
          description: >-
            A Chat Completions request body. Every parameter the synchronous
            endpoint accepts works here, except `stream: true`, which is
            rejected.
          example:
            model: morph-glm53flash
            messages:
              - role: user
                content: 'Summarize this diff in one sentence: ...'
            max_tokens: 256
      required:
        - custom_id
        - method
        - url
        - body
      description: 'One line of the JSONL input file: a single chat-completion request.'
      example:
        custom_id: req-0001
        method: POST
        url: /v1/chat/completions
        body:
          model: morph-glm53flash
          messages:
            - role: user
              content: 'Summarize this diff in one sentence: ...'
          max_tokens: 256
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: invalid_request_error
              description: Machine-readable error code.
            message:
              type: string
              example: The request body is missing the `model` field.
              description: Human-readable explanation of the failure.
          required:
            - code
            - message
      required:
        - error
      description: Standard error envelope returned by every non-2xx response.
      example:
        error:
          code: invalid_request_error
          message: The request body is missing the `model` field.
  responses:
    BadRequest:
      description: Malformed request — missing or invalid fields.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: invalid_request_error
              message: The request body is missing the `model` field.
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: unauthorized
              message: Invalid API key provided.
    NotFound:
      description: The requested resource does not exist.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: not_found
              message: No fine-tuning job found with id ftjob-8f2k1.
    RateLimited:
      description: Rate limited — retry after the interval in the Retry-After header.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: rate_limited
              message: Too many requests. Retry in 12 seconds.
    InternalError:
      description: Internal error — safe to retry with backoff.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: internal_error
              message: Something went wrong on our side.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: opaque
      description: >-
        Morph API key, passed as `Authorization: Bearer sk-...`. Create keys at
        https://www.morphllm.com/dashboard/api-keys.

````