---
title: "Export secrets"
method: POST
path: "/secrets/export"
---

# Export secrets

`POST /secrets/export`

Lists all the secrets in your current account and re-encrypt them with the public key you supplied.

## Request body

- ExportSecretsParams
  - `$schema` string, uri — A URL to the JSON Schema for this object.
  - `all` boolean, required — Whether to fetch all secrets or only the ones that are not marked as deleted.
  - `environment` string, required — The environment to filter by.
  - `page` integer, required — The page number to fetch.
  - `page_size` integer, required — The number of records to fetch on each page.
  - `public_key` string, required — The PEM-encoded public key you want to use to encrypt sensitive secret values.

## Response `200`

OK

- ExportSecretsResponse
  - `$schema` string, uri — A URL to the JSON Schema for this object.
  - `pages` Pagination, required
    - `num_pages` integer, required
    - `page` integer, required
    - `page_size` integer, required
    - `total` integer, required
  - `secrets` ExportedSecret[], required
    - `created_at` string, date-time, required
    - `encrypted_value` string, required
    - `environment` string, required
    - `name` string, required

## Other responses

- `default` — Error

---

[API](https://skmtc.net/tower/apis/tower-api.md) · [All operations](https://skmtc.net/tower/apis/tower-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/tower/tower-api/revisions/0e42b0fb26d9/schema)
