---
title: "Export a session as a file"
method: POST
path: "/v1/sessions/{session_id}/exports"
tags: ["Analysis"]
---

# Export a session as a file

`POST /v1/sessions/{session_id}/exports`

## Request

- Base URL: `https://carbonguru.io`
- URL: `https://carbonguru.io/v1/sessions/{session_id}/exports`
- Auth: HTTP bearer

csv and json are ready at 200. xlsx and pdf generate and answer 202; poll the job.

## Path parameters

- `session_id` string, required

## Headers

- `Idempotency-Key` string

## Request body

- ExportRequest
  - `format` 'csv' | 'xlsx' | 'json' | 'pdf', required

## Response `200`

The file is ready.

- ExportJob
  - `job_id` string, required
  - `status` 'ready' | 'generating' | 'failed', required
  - `format` 'csv' | 'xlsx' | 'json' | 'pdf', required
  - `download_url` string
  - `links` object, required
    - `export` string

## Other responses

- `202`: The file is generating.
- `401`: No valid credential. Every authentication failure returns this one document.
- `402`: The account's plan does not include this capability. Carries min_tier and upgrade_url.
- `403`: A missing scope, an exhausted analysis allowance, or an object that is not the caller's.
- `404`: No such resource.
- `409`: An Idempotency-Key was reused with a different body (idempotency_key_reuse), or a request under the same key is still running (idempotency_in_progress).
- `422`: The request's fields are wrong. errors[] names them.
- `429`: The platform's rate limit. Retry-After carries its own stated wait.
- `503`: The platform is not serving this capability.

---

[API](https://skmtc.dev/carbonguru/apis/carbonguru-api.md) · [All operations](https://skmtc.dev/carbonguru/apis/carbonguru-api/llms.txt) · [OpenAPI document](https://skmtc.dev/carbonguru/apis/carbonguru-api/revisions/26dcbe7a8500?raw)
