---
title: "Creates an ephemeral certificate for the current API Session"
method: POST
path: "/current-api-session/certificates"
tags: ["Current API Session"]
---

# Creates an ephemeral certificate for the current API Session

`POST /current-api-session/certificates`

## Request

- Base URL: `https://demo.ziti.dev/edge/client/v1`
- URL: `https://demo.ziti.dev/edge/client/v1/current-api-session/certificates`
- Auth: one of:
  - API key in header `zt-session`
  - OAuth 2
    - Authorization code: `/oidc/authorize`
    - Token URL: `/oidc/token` scopes: `openid`
- TypeScript: <https://skmtc.dev/openziti/apis/ziti-edge-client/docs/current-api-session/certificates/post.ts> (a function with typed inputs; its response is checked against the schema)

Creates an ephemeral certificate for the current API Session. This endpoint expects a PEM encoded CSRs to be provided for fulfillment as a property of a JSON payload. It is up to the client to manage the private key backing the CSR request.

## Request body

- CurrentApiSessionCertificateCreate
  - `csr` string, required

## Response `201`

A response of a create API Session certificate

- CreateCurrentApiSessionCertificateEnvelope
  - `data` CurrentApiSessionCertificateCreateResponse, required
    - `_links` object: A map of named links
    - `id` string
    - `cas` string
    - `certificate` string, required
  - `meta` Meta, required
    - `apiEnrollmentVersion` string
    - `apiVersion` string
    - `filterableFields` string[]
    - `pagination` Pagination
      - `limit` number, required
      - `offset` number, required
      - `totalCount` number, required

## Other responses

- `400`: The supplied request contains invalid fields or could not be parsed (json and non-json bodies). The error's code, message, and cause fields can be inspected for further information
- `401`: The supplied session does not have the correct access rights to request this resource
- `429`: The resource requested is rate limited and the rate limit has been exceeded
- `503`: The request could not be completed due to the server being busy or in a temporarily bad state

## Changes

- **2025-01-24** `19dfd92f02a2`: 1 info
  - added the non-success response with the status `503`
- **2024-05-29** `cce2800c1357`: 4 warning, 1 info
  - the optional response header `WWW-Authenticate` removed for the status `201`
  - the optional response header `WWW-Authenticate` removed for the status `400`
  - the optional response header `WWW-Authenticate` removed for the status `401`
  - the optional response header `WWW-Authenticate` removed for the status `429`
  - …1 more

[Operation history](https://skmtc.dev/openziti/apis/ziti-edge-client/changes/current-api-session/certificates/post.md)

---

[API](https://skmtc.dev/openziti/apis/ziti-edge-client.md) - [All operations](https://skmtc.dev/openziti/apis/ziti-edge-client/llms.txt) - [OpenAPI document](https://skmtc.dev/openziti/apis/ziti-edge-client/revisions/f7b51eaafbbb?raw)
