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

# Get Artifact Payload

> Download the raw bytes of an artifact

Returns the raw payload bytes of an artifact — the persisted chart spec JSON, the exported document, and so on. Check status first with [Get Artifact](/api-reference/artifacts/get-artifact); fetch the payload once `status` is `ready`.

<Note>
  Member-scoped through the owning chat — an artifact from another member's chat returns `404`.
</Note>

<ParamField header="Authorization" type="string" required>
  Bearer token obtained from the [authenticate](/api-reference/authentication/authenticate) endpoint.
</ParamField>

<ParamField path="artifact_id" type="string" required>
  The artifact id, as surfaced on a `tool_result` frame.
</ParamField>

## Response

The raw bytes, served with the artifact's own `Content-Type`. Response headers:

<ResponseField name="Content-Type" type="string">
  The artifact's MIME type (e.g. `application/json` for a chart spec).
</ResponseField>

<ResponseField name="Content-Disposition" type="string">
  `inline` for allowlisted image, PDF, audio, and video types; `attachment` for everything else, including JSON, HTML, SVG, and XLSX. The header contains only the disposition token, not a filename; use the status response's `filename` when non-null, or choose a local fallback such as `chart.json` for a JSON `chart_spec`.
</ResponseField>

<ResponseField name="X-Artifact-Type" type="string">
  The artifact type, mirroring [Get Artifact](/api-reference/artifacts/get-artifact)'s `artifact_type`.
</ResponseField>

<ResponseField name="Cache-Control" type="string">
  `no-store` for mutable `chat_export` payloads; `private, max-age=300` for other artifact types.
</ResponseField>

<ResponseField name="X-Content-Type-Options" type="string">
  Always `nosniff`.
</ResponseField>

<RequestExample>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X GET https://api.trellis.sh/v1/artifacts/1b9d4c22-77ea-4d0f-8a3e-9f0c2b6a1e55/payload \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -o chart.json
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import requests

  response = requests.get(
      "https://api.trellis.sh/v1/artifacts/1b9d4c22-77ea-4d0f-8a3e-9f0c2b6a1e55/payload",
      headers={"Authorization": "Bearer YOUR_TOKEN"},
  )
  payload_bytes = response.content
  content_type = response.headers["Content-Type"]
  ```

  ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  const response = await fetch(
    "https://api.trellis.sh/v1/artifacts/1b9d4c22-77ea-4d0f-8a3e-9f0c2b6a1e55/payload",
    { headers: { Authorization: "Bearer YOUR_TOKEN" } },
  );
  const blob = await response.blob();
  ```
</RequestExample>

<ResponseExample>
  ```json 200 (chart_spec payload) theme={"theme":{"light":"github-light","dark":"github-dark"}}
  {
    "chart_type": "bar",
    "title": "Top Projects by Budget",
    "x": {"field": "project_name", "label": "Project", "type": "string"},
    "y": [{"field": "budget", "label": "Budget (AED)", "type": "number"}],
    "data": {
      "columns": [
        {"name": "project_name", "type_hint": "string"},
        {"name": "budget", "type_hint": "number"}
      ],
      "rows": [["Al Raha Beach Tower", 12800000]],
      "truncated": false
    },
    "options": {}
  }
  ```

  A `chart_spec` artifact is persisted before the 2,000-row inline chart cap is applied, so this payload can contain more rows than the inline tool result. Its `data.truncated` field reflects truncation by the upstream scoped query, not the inline cap. A value of `false` means the artifact contains the full result returned for that chart, but does not make the artifact an unbounded export.

  <Warning>
    `table_export` and its `filename`, `row_count`, and `truncated` metadata are in a forthcoming API deployment. They are not available on the currently deployed API revision.
  </Warning>

  For a `table_export`, the successful body is the raw XLSX file. Its status response supplies `filename`, `row_count`, and `truncated`.

  ```json 404 theme={"theme":{"light":"github-light","dark":"github-dark"}}
  {
    "detail": "Artifact not found"
  }
  ```

  ```json 502 theme={"theme":{"light":"github-light","dark":"github-dark"}}
  {
    "detail": "Artifact payload unavailable"
  }
  ```
</ResponseExample>
