Terraform
Metrics service tokens API reference
Metrics Service is an independent observability service. Tokens generated here allow your observability tools to authenticate directly with Metrics Service to read telemetry data.
Generate a new token
POST /organizations/:organization_name/metrics-tokens
| Parameter | Description |
|---|---|
:organization_name | The name of the organization to generate a token for. |
Generates a new Metrics Service token.
Only members of the owners team, the owners team API token, and the organization API token can access this endpoint.
This endpoint returns the secret text of the new authentication token. You can only access this token when you create it and can not recover it later.
| Status | Response | Reason |
|---|---|---|
| 201 | JSON API document (type: "metrics-tokens") | Success |
| 404 | JSON API error object | User not authorized |
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 "metrics-tokens". | |
data.attributes.name | string | The name of the token. |
Sample Payload
{
"data": {
"type": "metrics-tokens",
"attributes": {
"name": "my-token-1"
}
}
}
Sample Request
curl \
--header "Authorization: Bearer $TOKEN" \
--header "Content-Type: application/vnd.api+json" \
--request POST \
--data @payload.json \
https://app.terraform.io/api/v2/organizations/my-organization/metrics-tokens
Sample Response
{
"data": {
"id": "abc123def456ghi789jkl012mno345pqr",
"type": "metrics-tokens",
"attributes": {
"name": "my-token-1",
"token-id": "abc123def456ghi789jkl012mno345pqr",
"created-at": "2026-04-22T21:12:07.481460751Z",
"token": "hcpt_abcdefg1234567812345678123456789.12345678f40c2a477defc201caa7ecda9d04835190e4d81763e82b8300000000"
}
}
}
List tokens
GET /organizations/:organization_name/metrics-tokens
| Parameter | Description |
|---|---|
:organization_name | The name of the organization to list tokens for. |
Lists all Metrics service tokens for the organization.
Only members of the owners team, the owners team API token, and the organization API token can access this endpoint.
| Status | Response | Reason |
|---|---|---|
| 200 | JSON API document (type: "metrics-tokens") | Success |
| 404 | JSON API error object | User not authorized |
Sample Request
curl \
--header "Authorization: Bearer $TOKEN" \
--header "Content-Type: application/vnd.api+json" \
https://app.terraform.io/api/v2/organizations/my-organization/metrics-tokens
Sample Response
{
"data": [
{
"id": "abc123def456ghi789jkl012mno345pqr",
"type": "metrics-tokens",
"attributes": {
"name": "my-token-1",
"token-id": "abc123def456ghi789jkl012mno345pqr",
"created-at": "2026-04-22T21:12:07Z"
}
},
{
"id": "def456ghi789jkl012mno345pqrabc123",
"type": "metrics-tokens",
"attributes": {
"name": "my-token-2",
"token-id": "def456ghi789jkl012mno345pqrabc123",
"created-at": "2026-04-22T17:26:20Z"
}
}
]
}
Delete a token
DELETE /organizations/:organization_name/metrics-tokens/:id
| Parameter | Description |
|---|---|
:organization_name | Which organization's token should be deleted. |
:id | The ID of the token to delete. |
Deletes a Metrics Service token.
Only members of the owners team, the owners team API token, and the organization API token can access this endpoint.
| Status | Response | Reason |
|---|---|---|
| 204 | No Content | Success |
| 404 | JSON API error object | User not authorized |
Sample Request
curl \
--header "Authorization: Bearer $TOKEN" \
--header "Content-Type: application/vnd.api+json" \
--request DELETE \
https://app.terraform.io/api/v2/organizations/my-organization/metrics-tokens/abc123def456ghi789jkl012mno345pqr