# Company Listings Export API

> Read-only REDE v0.93 XML export of a company's own active listings. For companies with a leiakv.ee account; requires an API key.

## Endpoint

GET https://leiakv.ee/api/company/{companyId}/export

## Authentication

Requires an API key with `export` permission, created via the company dashboard
(`POST https://leiakv.ee/api/company/api-keys`). Send it as either:

- `Authorization: Bearer <key>` header, or
- `X-API-Key: <key>` header

The key must belong to the company being queried — keys are not cross-company.

## Query Parameters

| Param    | Values                                                   | Default  |
|----------|-----------------------------------------------------------|----------|
| `format` | `xml` (default) or `json`                                | `xml`    |
| `status` | `active` (default), `all`, or a specific listing status  | `active` |

## Response

- `format=xml` (default): `application/xml`, REDE v0.93-conformant export, `Content-Disposition: attachment`.
- `format=json`: `application/json`, the same data as a structured object.
- `401`: missing/invalid API key.
- `403`: API key valid but not authorized for the requested `companyId`.
- `500`: internal error.

## Status

https://leiakv.ee/api/health

---

*This document is machine- and human-readable and is referenced as the `service-doc`
for this API in https://leiakv.ee/.well-known/api-catalog (RFC 9727).*
