- Terraform Enterprise
- 2.1.x (latest)
- 2.0.x
- 1.2.x
- 1.1.x
- 1.0.x
- v202507-1
- v202506-1
- v202505-1
- v202504-1
- v202503-1
- v202502-2
- v202502-1
- v202501-1
- v202411-2
- v202411-1
- v202410-1
- v202409-3
- v202409-2
- v202409-1
- v202408-1
- No versions of this document exist before v202408-1. Click below to redirect to the version homepage.
- v202407-1
- v202406-1
- v202405-1
- v202404-2
- v202404-1
- v202402-2
- v202402-1
- v202401-2
- v202401-1
- v202312-1
- v202311-1
- v202310-1
- v202309-1
- v202308-1
- v202307-1
- v202306-1
- v202305-2
- v202305-1
- v202304-1
- v202303-1
- v202302-1
- v202301-2
- v202301-1
- v202212-2
- v202212-1
- v202211-1
- v202210-1
- v202209-2
- v202209-1
- v202208-3
- v202208-2
- v202208-1
- v202207-2
- v202207-1
- v202206-1
Admin SAML IdP Certificates API
This topic provides reference information for the /admin/saml-settings/idp-certificates endpoints, which manage the SAML identity provider (IdP) certificates that Terraform Enterprise trusts.
Terraform Enterprise verifies the signature on each SAML response against these certificates. It can trust multiple certificates at the same time and tries each one until a signature validates, so you can run a multi-region IdP, migrate between identity providers, or rotate a certificate without interrupting logins. Refer to Manage IdP certificates for conceptual information.
Terraform Enterprise Only: The admin API is exclusive to Terraform Enterprise, and only site administrators can use these endpoints.
Request and response documents use the JSON:API resource type saml-idp-certificates.
Certificate attributes
| Attribute | Type | Read-only | Description |
|---|---|---|---|
id | string | Yes | The external identifier for the certificate, prefixed with idpc-. |
display-name | string | No | A human-readable label for the certificate. This attribute is required when you add a certificate. |
cert | string | No | The PEM encoded X.509 certificate body. Terraform Enterprise normalizes the value you send before it stores it. |
fingerprint | string | Yes | The colon-separated, uppercase SHA-256 fingerprint of the certificate's DER bytes. Terraform Enterprise derives this value from cert and uses it to reject duplicate certificates. |
issuer | string | Yes | The certificate issuer, formatted as "<ORGANIZATION>, <COMMON NAME>". Returns null when the certificate has neither an organization nor a common name. |
expires-at | timestamp | Yes | The certificate's notAfter date. Terraform Enterprise derives this value from cert. |
created-at | timestamp | Yes | The date and time when the certificate was added. |
cert-role | string | Yes | The role of the certificate. Refer to Certificate roles. |
Certificate roles
| Role | Description |
|---|---|
managed | A certificate added through these endpoints. Terraform Enterprise trusts it at authentication time. |
legacy_primary | The certificate exposed as the deprecated idp-cert attribute in SAML settings. Terraform Enterprise trusts it at authentication time. |
legacy_old | The certificate exposed as the deprecated old-idp-cert attribute. Terraform Enterprise trusts it at authentication time, but it does not satisfy the requirement that SAML has at least one trusted certificate. |
Terraform Enterprise assigns the legacy_primary and legacy_old roles only through the deprecated idp-cert attribute on Update SAML settings. Every certificate you add through these endpoints is managed.
Certificate lifecycle rules
- You can call every endpoint on this page whether or not SAML is enabled. This lets you add your first certificate before you enable SAML.
- A certificate added while SAML is disabled is inert until you enable SAML.
- Enabling SAML requires at least one certificate with a role of
legacy_primaryormanaged. - Terraform Enterprise rejects a certificate that it cannot parse, a certificate that has already expired, and a certificate whose fingerprint matches a certificate it already trusts.
- While SAML is enabled, Terraform Enterprise refuses to delete the last certificate with a role of
legacy_primaryormanaged.
List SAML IdP certificates
GET /api/v2/admin/saml-settings/idp-certificates
This endpoint returns every trusted IdP certificate, including the full certificate body. Terraform Enterprise returns the certificates in a deterministic order: the legacy_primary certificate first, then the legacy_old certificate, then managed certificates ordered by when they were last updated.
| Status | Response | Reason |
|---|---|---|
| 200 | JSON API document (type: "saml-idp-certificates") | Successfully listed IdP certificates |
| 404 | JSON API error object | User unauthorized to perform action |
| 503 | JSON API error object | Vault is unavailable, so the certificate bodies cannot be read |
Sample Request
curl \
--header "Authorization: Bearer $TOKEN" \
--header "Content-Type: application/vnd.api+json" \
--request GET \
https://tfe.example.com/api/v2/admin/saml-settings/idp-certificates
Sample Response
{
"data": [
{
"id": "idpc-AbC123",
"type": "saml-idp-certificates",
"attributes": {
"display-name": "Migrated Legacy Primary Cert",
"cert": "-----BEGIN CERTIFICATE-----\nMII...PRIMARY==\n-----END CERTIFICATE-----",
"fingerprint": "9A:1B:0C:...:F2",
"issuer": "Example Corp, idp.example.com",
"expires-at": "2027-01-15T00:00:00Z",
"created-at": "2026-06-15T10:00:00Z",
"cert-role": "legacy_primary"
}
},
{
"id": "idpc-XyZ789",
"type": "saml-idp-certificates",
"attributes": {
"display-name": "EU cluster",
"cert": "-----BEGIN CERTIFICATE-----\nMII...EU==\n-----END CERTIFICATE-----",
"fingerprint": "44:7C:1D:...:9D",
"issuer": "Example Corp, eu.idp.example.com",
"expires-at": "2027-06-01T00:00:00Z",
"created-at": "2026-06-16T09:30:00Z",
"cert-role": "managed"
}
}
]
}
Show a SAML IdP certificate
GET /api/v2/admin/saml-settings/idp-certificates/:certificate_id
| Parameter | Description |
|---|---|
:certificate_id | The external ID of the certificate, such as idpc-XyZ789. |
| Status | Response | Reason |
|---|---|---|
| 200 | JSON API document (type: "saml-idp-certificates") | Successfully returned the certificate |
| 404 | JSON API error object | Certificate not found or user unauthorized to perform action |
| 503 | JSON API error object | Vault is unavailable, so the certificate body cannot be read |
Sample Request
curl \
--header "Authorization: Bearer $TOKEN" \
--header "Content-Type: application/vnd.api+json" \
--request GET \
https://tfe.example.com/api/v2/admin/saml-settings/idp-certificates/idpc-XyZ789
Sample Response
{
"data": {
"id": "idpc-XyZ789",
"type": "saml-idp-certificates",
"attributes": {
"display-name": "EU cluster",
"cert": "-----BEGIN CERTIFICATE-----\nMII...EU==\n-----END CERTIFICATE-----",
"fingerprint": "44:7C:1D:...:9D",
"issuer": "Example Corp, eu.idp.example.com",
"expires-at": "2027-06-01T00:00:00Z",
"created-at": "2026-06-16T09:30:00Z",
"cert-role": "managed"
}
}
}
Add a SAML IdP certificate
POST /api/v2/admin/saml-settings/idp-certificates
This endpoint adds a certificate to the trusted set. Terraform Enterprise derives fingerprint, issuer, and expires-at from the certificate body, and always assigns the managed role. If SAML is enabled, Terraform Enterprise trusts the new certificate immediately.
| Status | Response | Reason |
|---|---|---|
| 201 | JSON API document (type: "saml-idp-certificates") | Successfully added the certificate |
| 404 | JSON API error object | User unauthorized to perform action |
| 422 | JSON API error object | The certificate could not be parsed, has expired, is already trusted, or a required attribute is missing |
| 503 | JSON API error object | Vault is unavailable, so the certificate cannot be encrypted. Terraform Enterprise stores nothing. |
Request Body
This POST endpoint requires a JSON object with the following properties as a request payload.
| Key path | Type | Default | Description |
|---|---|---|---|
data.type | string | Must be "saml-idp-certificates". | |
data.attributes.display-name | string | Required. A human-readable label for the certificate. | |
data.attributes.cert | string | Required. The PEM encoded X.509 certificate provided by your IdP configuration. |
Sample Payload
{
"data": {
"type": "saml-idp-certificates",
"attributes": {
"display-name": "EU cluster",
"cert": "-----BEGIN CERTIFICATE-----\nMII...EU==\n-----END CERTIFICATE-----"
}
}
}
Sample Request
curl \
--header "Authorization: Bearer $TOKEN" \
--header "Content-Type: application/vnd.api+json" \
--request POST \
--data @payload.json \
https://tfe.example.com/api/v2/admin/saml-settings/idp-certificates
Sample Response
{
"data": {
"id": "idpc-XyZ789",
"type": "saml-idp-certificates",
"attributes": {
"display-name": "EU cluster",
"cert": "-----BEGIN CERTIFICATE-----\nMII...EU==\n-----END CERTIFICATE-----",
"fingerprint": "44:7C:1D:...:9D",
"issuer": "Example Corp, eu.idp.example.com",
"expires-at": "2027-06-01T00:00:00Z",
"created-at": "2026-06-16T09:30:00Z",
"cert-role": "managed"
}
}
}
Update a SAML IdP certificate
PATCH /api/v2/admin/saml-settings/idp-certificates/:certificate_id
This endpoint updates a certificate in place. Send display-name to rename the certificate, cert to replace the certificate body, or both. Terraform Enterprise preserves the id, created-at, and cert-role, and re-derives fingerprint, issuer, and expires-at when you replace the body.
You can rename any certificate. You can only replace the body of a managed certificate. To rotate a legacy_primary or legacy_old certificate, use the deprecated idp-cert attribute on Update SAML settings so that Terraform Enterprise preserves the legacy rotation behavior.
| Status | Response | Reason |
|---|---|---|
| 200 | JSON API document (type: "saml-idp-certificates") | Successfully updated the certificate |
| 404 | JSON API error object | Certificate not found or user unauthorized to perform action |
| 422 | JSON API error object | The certificate could not be parsed, has expired, is already trusted, or you tried to replace the body of a legacy certificate |
| 503 | JSON API error object | Vault is unavailable. The stored certificate is unchanged. |
Request Body
This PATCH endpoint requires a JSON object with the following properties as a request payload. You can omit either attribute. Omitted attributes keep their previous values.
| Key path | Type | Default | Description |
|---|---|---|---|
data.type | string | Must be "saml-idp-certificates". | |
data.attributes.display-name | string | A new human-readable label for the certificate. Allowed for any certificate. | |
data.attributes.cert | string | A replacement PEM encoded X.509 certificate. Only allowed when cert-role is managed. |
Sample Payload
The following payload renames the certificate and replaces its body.
{
"data": {
"type": "saml-idp-certificates",
"attributes": {
"display-name": "EU cluster (primary region)",
"cert": "-----BEGIN CERTIFICATE-----\nMII...RENEWED==\n-----END CERTIFICATE-----"
}
}
}
Sample Request
curl \
--header "Authorization: Bearer $TOKEN" \
--header "Content-Type: application/vnd.api+json" \
--request PATCH \
--data @payload.json \
https://tfe.example.com/api/v2/admin/saml-settings/idp-certificates/idpc-XyZ789
Sample Response
{
"data": {
"id": "idpc-XyZ789",
"type": "saml-idp-certificates",
"attributes": {
"display-name": "EU cluster (primary region)",
"cert": "-----BEGIN CERTIFICATE-----\nMII...RENEWED==\n-----END CERTIFICATE-----",
"fingerprint": "E1:9F:2A:...:0C",
"issuer": "Example Corp, eu.idp.example.com",
"expires-at": "2028-06-01T00:00:00Z",
"created-at": "2026-06-16T09:30:00Z",
"cert-role": "managed"
}
}
}
Download a SAML IdP certificate
GET /api/v2/admin/saml-settings/idp-certificates/:certificate_id/download
This endpoint returns the normalized PEM body as a file attachment instead of a JSON:API document. Terraform Enterprise sets Content-Type: application/x-pem-file and names the file idp-cert-<CERTIFICATE ID>.pem.
| Status | Response | Reason |
|---|---|---|
| 200 | PEM certificate | Successfully returned the certificate |
| 404 | JSON API error object | Certificate not found or user unauthorized to perform action |
| 503 | JSON API error object | Vault is unavailable, so the certificate body cannot be read |
Sample Request
curl \
--header "Authorization: Bearer $TOKEN" \
--request GET \
--remote-name --remote-header-name \
https://tfe.example.com/api/v2/admin/saml-settings/idp-certificates/idpc-XyZ789/download
Sample Response
-----BEGIN CERTIFICATE-----
MII...EU==
-----END CERTIFICATE-----
Delete a SAML IdP certificate
DELETE /api/v2/admin/saml-settings/idp-certificates/:certificate_id
This endpoint removes the certificate from the trusted set.
While SAML is enabled, Terraform Enterprise rejects the request when the deletion would leave no certificates with a role of legacy_primary or managed. A legacy_old certificate does not count toward this requirement, so add another certificate or disable SAML first. While SAML is disabled, you can delete any certificate.
| Status | Response | Reason |
|---|---|---|
| 204 | No content | Successfully deleted the certificate |
| 404 | JSON API error object | Certificate not found or user unauthorized to perform action |
| 422 | JSON API error object | The certificate is the last trusted certificate and SAML is enabled |
Sample Request
curl \
--header "Authorization: Bearer $TOKEN" \
--header "Content-Type: application/vnd.api+json" \
--request DELETE \
https://tfe.example.com/api/v2/admin/saml-settings/idp-certificates/idpc-XyZ789
Validate a certificate
POST /api/v2/admin/saml-settings/actions/cert-validation
This endpoint inspects a certificate body without storing it. Use it to check a certificate and read its issuer, expiration date, and signature algorithm before you add it.
Validation is not the same as the checks that Add a SAML IdP certificate performs. This endpoint does not enforce the duplicate-fingerprint rule, and it never persists a certificate.
| Status | Response | Reason |
|---|---|---|
| 200 | JSON API document (type: "saml-cert-validations") | Successfully inspected the certificate body |
| 404 | JSON API error object | User unauthorized to perform action |
| 422 | JSON API error object | The cert attribute is missing from the request body |
Request Body
This POST endpoint requires a JSON object with the following properties as a request payload.
| Key path | Type | Default | Description |
|---|---|---|---|
data.type | string | Must be "saml-cert-validations". | |
data.attributes.cert | string | Required. The PEM encoded X.509 certificate body. |
Response Attributes
| Attribute | Type | Description |
|---|---|---|
is-valid | bool | Whether the certificate parses as an X.509 certificate and has not expired. |
issuer | string | The certificate issuer, formatted as "<ORGANIZATION>, <COMMON NAME>". |
expires-at | timestamp | The certificate's notAfter date. |
signature-algorithm | string | The signature algorithm name, such as sha256WithRSAEncryption or ecdsa-with-SHA256. |
When Terraform Enterprise cannot parse the body, it returns "is-valid": false and omits the other attributes. When the body parses but the certificate has expired, Terraform Enterprise returns "is-valid": false along with the issuer, expiration date, and signature algorithm.
Sample Payload
{
"data": {
"type": "saml-cert-validations",
"attributes": {
"cert": "-----BEGIN CERTIFICATE-----\nMII...EU==\n-----END CERTIFICATE-----"
}
}
}
Sample Request
curl \
--header "Authorization: Bearer $TOKEN" \
--header "Content-Type: application/vnd.api+json" \
--request POST \
--data @payload.json \
https://tfe.example.com/api/v2/admin/saml-settings/actions/cert-validation
Sample Response
{
"data": {
"type": "saml-cert-validations",
"attributes": {
"is-valid": true,
"issuer": "Example Corp, eu.idp.example.com",
"expires-at": "2027-06-01T00:00:00Z",
"signature-algorithm": "sha256WithRSAEncryption"
}
}
}
Sample Response for an unparseable certificate
{
"data": {
"type": "saml-cert-validations",
"attributes": {
"is-valid": false
}
}
}