---
title: "Export contacts as CSV"
method: POST
path: "/contacts/export"
tags: ["Contacts"]
---

# Export contacts as CSV

`POST /contacts/export`

## Request

- Base URL: `https://api.textla.com/v1`
- URL: `https://api.textla.com/v1/contacts/export`
- Auth: HTTP bearer

Streams every contact in the authenticated account that matches the supplied filter tree as text/csv. The account ID is taken from the bearer token, never from the request body. An empty or omitted body matches every contact in the account. When the request advertises an acceptable gzip encoding, the CSV body is streamed gzip-encoded with `Content-Encoding: gzip` and `Vary: Accept-Encoding`; otherwise the raw CSV representation is returned. A successful empty export may remain identity with no Content-Encoding even when gzip was accepted. Once the HTTP 200 response has started, a later application, upstream, paging, idle, or total-timeout failure may still end as HTTP 200 with a clean EOF and a partial identity CSV or a valid, normally closed partial gzip member. There is no in-band abort marker. Operators can measure those known failures through bounded terminal_reason telemetry; monitoring cannot prove whether a client accepted partial data. Failures found during first-page preflight remain RFC 7807 HTTP errors, but failures found after streaming begins may return an empty or partial 200 response even before the first CSV record is written. There is no proactive encoded-size cap, so oversized responses may reach the Lambda Runtime API 413 boundary after work has been performed. `Accept-Encoding` interpretation and compressor finalization are delegated to gzhttp and do not provide a completeness signal. A blocked finalization write is stopped by a dedicated five-second deadline inside the Lambda timeout margin. Clients that require completeness need an independent row count or digest. Requires a user-scope token; tenant-admin tokens are rejected with 403.

## Headers

- `Accept-Encoding` string

## Request body

- object

## Response `200`

CSV export stream

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `412`: Precondition Failed
- `422`: Unprocessable Entity
- `500`: Internal Server Error
- `502`: Bad Gateway
- `503`: Service Unavailable
- `504`: Gateway Timeout

---

[API](https://skmtc.dev/textla/apis/textla-api.md) - [All operations](https://skmtc.dev/textla/apis/textla-api/llms.txt) - [OpenAPI document](https://skmtc.dev/textla/apis/textla-api/revisions/473f03350bc1?raw)
