---
title: Create a Custom OIDC intake mapping
description: Create a Custom OIDC intake mapping.
breadcrumbs: Docs > API > Create a Custom OIDC intake mapping
---

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

# Create a Custom OIDC intake mapping

## v2 (latest)

{% alert level="warning" %}
**Note**: This endpoint is in preview and is subject to change. Custom OIDC authentication must be enabled for your organization.
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help.md).
{% /alert %}

| Datadog site      | API endpoint                                                      |
| ----------------- | ----------------------------------------------------------------- |
| app.datadoghq.com | POST https://api.datadoghq.com/api/v2/wif/oidc/intake_mapping     |
| us3.datadoghq.com | POST https://api.us3.datadoghq.com/api/v2/wif/oidc/intake_mapping |
| us5.datadoghq.com | POST https://api.us5.datadoghq.com/api/v2/wif/oidc/intake_mapping |
| app.datadoghq.eu  | POST https://api.datadoghq.eu/api/v2/wif/oidc/intake_mapping      |
| ap1.datadoghq.com | POST https://api.ap1.datadoghq.com/api/v2/wif/oidc/intake_mapping |
| ap2.datadoghq.com | POST https://api.ap2.datadoghq.com/api/v2/wif/oidc/intake_mapping |
| uk1.datadoghq.com | POST https://api.uk1.datadoghq.com/api/v2/wif/oidc/intake_mapping |
| app.ddog-gov.com  | POST https://api.ddog-gov.com/api/v2/wif/oidc/intake_mapping      |
| us2.ddog-gov.com  | POST https://api.us2.ddog-gov.com/api/v2/wif/oidc/intake_mapping  |

### Overview

Create a Custom OIDC intake mapping. An intake mapping lets tokens from a registered Custom OIDC
provider submit telemetry when their claims match the mapping. Both Custom OIDC authentication
and managed API key rotation must be enabled for the organization.

This endpoint requires the `workload_identity_federation_write` permission.

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

### Request

#### Body Data (required)

{% tabs %}
{% tab label="Model" %}
| Parent field   | Field                    | Type     | Description                                                                                                                                                                                                                                                                         |
| -------------- | ------------------------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|                | data [*required*]        | object   | Custom OIDC intake mapping creation data.                                                                                                                                                                                                                                           |
| data           | attributes [*required*]  | object   | Attributes for creating a Custom OIDC intake mapping.                                                                                                                                                                                                                               |
| attributes     | claim_matchers           | [object] | Claim conditions that a token must match. Every condition must match. Provide `claim_matchers` or `identity_pattern`, but not both. You can omit this field when the provider's issuer or `required_claims` already restrict tokens to your organization.                           |
| claim_matchers | claim [*required*]       | string   | Name of the token claim.                                                                                                                                                                                                                                                            |
| claim_matchers | mode                     | enum     | Case-sensitive matching mode. Exact compares strings. Glob matches the entire value: * matches any number of characters, including /, and ? matches one character. Other characters are literal; escaping is not supported. Allowed enum values: `exact`, `glob`. Default: `exact`. |
| claim_matchers | values [*required*]      | [string] | Accepted values for this claim. Each value is limited to 500 UTF-8 bytes when creating the resource.                                                                                                                                                                                |
| attributes     | identity_pattern         | string   | Legacy glob pattern matched against the provider identity claim, up to 500 UTF-8 bytes. Provide `identity_pattern` or `claim_matchers`, but not both. Datadog recommends `claim_matchers`.                                                                                          |
| attributes     | provider_id [*required*] | uuid     | UUID of the registered Custom OIDC provider.                                                                                                                                                                                                                                        |
| data           | type [*required*]        | enum     | Resource type for a Custom OIDC intake mapping. Allowed enum values: `custom_oidc_intake_mapping`. Default: `custom_oidc_intake_mapping`.                                                                                                                                           |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": {
    "type": "custom_oidc_intake_mapping",
    "attributes": {
      "provider_id": "00000000-0000-0000-0000-000000000004",
      "claim_matchers": [
        {
          "claim": "sub",
          "mode": "exact",
          "values": [
            "system:serviceaccount:agents:example-agent"
          ]
        }
      ]
    }
  }
}
```
{% /tab %}
{% /tabs %}

### Response

{% tabs %}
{% tab label="201" %}
Created

{% tabs %}
{% tab label="Model" %}
Custom OIDC intake mapping response.

| Parent field   | Field                   | Type      | Description                                                                                                                                                                                                                                                                         |
| -------------- | ----------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|                | data [*required*]       | object    | Custom OIDC intake mapping resource.                                                                                                                                                                                                                                                |
| data           | attributes [*required*] | object    | Stored Custom OIDC intake mapping attributes.                                                                                                                                                                                                                                       |
| attributes     | claim_matchers          | [object]  | Claim conditions that a token must match. A mapping uses either `claim_matchers` or `identity_pattern`.                                                                                                                                                                             |
| claim_matchers | claim [*required*]      | string    | Name of the token claim.                                                                                                                                                                                                                                                            |
| claim_matchers | mode                    | enum      | Case-sensitive matching mode. Exact compares strings. Glob matches the entire value: * matches any number of characters, including /, and ? matches one character. Other characters are literal; escaping is not supported. Allowed enum values: `exact`, `glob`. Default: `exact`. |
| claim_matchers | values [*required*]     | [string]  | Accepted values for this claim.                                                                                                                                                                                                                                                     |
| attributes     | created_at              | date-time | Time the configuration was created. Read-only.                                                                                                                                                                                                                                      |
| attributes     | created_by              | uuid      | UUID of the user who created the configuration. Read-only.                                                                                                                                                                                                                          |
| attributes     | identity_pattern        | string    | Legacy glob pattern matched against the provider identity claim. A mapping uses either `identity_pattern` or `claim_matchers`.                                                                                                                                                      |
| attributes     | provider_id             | uuid      | UUID of the registered Custom OIDC provider.                                                                                                                                                                                                                                        |
| attributes     | updated_at              | date-time | Time the configuration was last updated. Read-only.                                                                                                                                                                                                                                 |
| attributes     | updated_by              | uuid      | UUID of the user who last updated the configuration. Read-only.                                                                                                                                                                                                                     |
| data           | id [*required*]         | uuid      | Unique resource identifier.                                                                                                                                                                                                                                                         |
| data           | type [*required*]       | enum      | Resource type for a Custom OIDC intake mapping. Allowed enum values: `custom_oidc_intake_mapping`. Default: `custom_oidc_intake_mapping`.                                                                                                                                           |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": {
    "attributes": {
      "claim_matchers": [
        {
          "claim": "sub",
          "mode": "exact",
          "values": [
            "system:serviceaccount:controllers:example-controller"
          ]
        }
      ],
      "created_at": "2019-09-19T10:00:00.000Z",
      "created_by": "string",
      "identity_pattern": "system:serviceaccount:agents:example-agent",
      "provider_id": "00000000-0000-0000-0000-000000000002",
      "updated_at": "2019-09-19T10:00:00.000Z",
      "updated_by": "string"
    },
    "id": "00000000-0000-0000-0000-000000000004",
    "type": "custom_oidc_intake_mapping"
  }
}
```
{% /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="409" %}
Conflict

{% 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
# 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 POST "https://api.${DD_SITE}/api/v2/wif/oidc/intake_mapping" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "type": "custom_oidc_intake_mapping",
    "attributes": {
      "provider_id": "00000000-0000-0000-0000-000000000004",
      "claim_matchers": [
        {
          "claim": "sub",
          "mode": "exact",
          "values": [
            "system:serviceaccount:agents:example-agent"
          ]
        }
      ]
    }
  }
}
EOF
```
{% /tab %}
{% /tabs %}
