---
title: Get an HCP Terraform persona mapping
description: Get an HCP Terraform persona mapping by ID.
breadcrumbs: Docs > API > Get an HCP Terraform persona mapping
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Get an HCP Terraform persona mapping

## v2 (latest)

{% alert level="warning" %}
**Note**: This endpoint is in Preview and is subject to change.
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help.md).
{% /alert %}

| Datadog site      | API endpoint                                                                                |
| ----------------- | ------------------------------------------------------------------------------------------- |
| app.datadoghq.com | GET https://api.datadoghq.com/api/v2/wif/terraform/persona_mapping/{persona_mapping_id}     |
| us3.datadoghq.com | GET https://api.us3.datadoghq.com/api/v2/wif/terraform/persona_mapping/{persona_mapping_id} |
| us5.datadoghq.com | GET https://api.us5.datadoghq.com/api/v2/wif/terraform/persona_mapping/{persona_mapping_id} |
| app.datadoghq.eu  | GET https://api.datadoghq.eu/api/v2/wif/terraform/persona_mapping/{persona_mapping_id}      |
| ap1.datadoghq.com | GET https://api.ap1.datadoghq.com/api/v2/wif/terraform/persona_mapping/{persona_mapping_id} |
| ap2.datadoghq.com | GET https://api.ap2.datadoghq.com/api/v2/wif/terraform/persona_mapping/{persona_mapping_id} |
| uk1.datadoghq.com | GET https://api.uk1.datadoghq.com/api/v2/wif/terraform/persona_mapping/{persona_mapping_id} |
| app.ddog-gov.com  | GET https://api.ddog-gov.com/api/v2/wif/terraform/persona_mapping/{persona_mapping_id}      |
| us2.ddog-gov.com  | GET https://api.us2.ddog-gov.com/api/v2/wif/terraform/persona_mapping/{persona_mapping_id}  |

### Overview

Get an HCP Terraform persona mapping by ID.

This endpoint requires the `workload_identity_federation_read` permission.

OAuth apps require the `workload_identity_federation_read` authorization [scope](https://docs.datadoghq.com/api/latest/scopes.md#cloud-authentication) to access this endpoint.

### Arguments

#### Path Parameters

| Field                           | Type   | Description                   |
| ------------------------------- | ------ | ----------------------------- |
| persona_mapping_id [*required*] | string | The ID of the persona mapping |

### Response

{% tabs %}
{% tab label="200" %}
OK

{% tabs %}
{% tab label="Model" %}
Response containing a single HCP Terraform persona mapping.

| Parent field | Field                           | Type   | Description                                                                                                                                                                     |
| ------------ | ------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|              | data [*required*]               | object | HCP Terraform persona mapping resource.                                                                                                                                         |
| data         | attributes [*required*]         | object | Stored HCP Terraform persona mapping attributes.                                                                                                                                |
| attributes   | account_identifier [*required*] | string | Handle of the mapped Datadog account, resolved when the mapping was created.                                                                                                    |
| attributes   | account_uuid [*required*]       | string | UUID of the mapped Datadog user or service account.                                                                                                                             |
| attributes   | audience                        | string | Audience to set as the `TFC_WORKLOAD_IDENTITY_AUDIENCE_DATADOG` environment variable in HCP Terraform. Datadog computes this value as `datadog/<organization UUID>`. Read-only. |
| attributes   | issuer_url                      | string | HCP Terraform workload identity token issuer. Empty for mappings created before the issuer was required.                                                                        |
| attributes   | sub_pattern [*required*]        | string | Pattern matched against the `sub` claim of HCP Terraform workload identity tokens.                                                                                              |
| data         | id [*required*]                 | string | Unique identifier of the persona mapping.                                                                                                                                       |
| data         | type [*required*]               | enum   | Type identifier for an HCP Terraform persona mapping. Allowed enum values: `terraform_cloud_auth_config`. Default: `terraform_cloud_auth_config`.                               |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": {
    "attributes": {
      "account_identifier": "test@example.com",
      "account_uuid": "12bbdc5c-5966-47e0-8733-285f9e44bcf4",
      "audience": "datadog/abcdef12-3456-7890-abcd-ef1234567890",
      "issuer_url": "https://app.terraform.io",
      "sub_pattern": "organization:example-org:project:Default Project:workspace:example-workspace:run_phase:*"
    },
    "id": "6f1c7a52-3d2e-4f8b-9a41-0c5d8e7b2f19",
    "type": "terraform_cloud_auth_config"
  }
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="400" %}
Bad Request

{% tabs %}
{% tab label="Model" %}
API error response.

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | code                | string   | An application-specific error code.                                             |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "code": "invalid_request",
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="403" %}
Forbidden

{% tabs %}
{% tab label="Model" %}
API error response.

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | code                | string   | An application-specific error code.                                             |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "code": "invalid_request",
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="404" %}
Not Found

{% tabs %}
{% tab label="Model" %}
API error response.

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | code                | string   | An application-specific error code.                                             |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "code": "invalid_request",
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="429" %}
Too many requests

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}
{% /tabs %}

### Code Example

{% tabs %}
{% tab label="Curl" %}
```bash
# Path parameters
export persona_mapping_id="c5c758c6-18c2-4484-ae3f-46b84128404a"

# Set your Datadog site and credentials
export DD_SITE="datadoghq.com" # Or us3.datadoghq.com, us5.datadoghq.com, datadoghq.eu, ap1.datadoghq.com, ap2.datadoghq.com, uk1.datadoghq.com, ddog-gov.com, us2.ddog-gov.com
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X GET "https://api.${DD_SITE}/api/v2/wif/terraform/persona_mapping/${persona_mapping_id}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
```
{% /tab %}
{% /tabs %}
