---
title: "Create an AuthN Mapping"
method: POST
path: "/api/v2/authn_mappings"
tags: ["AuthN Mappings"]
---

# Create an AuthN Mapping

`POST /api/v2/authn_mappings`

## Request

- Base URL: `https://api.datadoghq.com`
- URL: `https://api.datadoghq.com/api/v2/authn_mappings`
- Auth: API key in header `DD-API-KEY` and API key in header `DD-APPLICATION-KEY`

Create an AuthN Mapping.

## Request body

- AuthNMappingCreateRequest: Request for creating an AuthN Mapping.
  - `data` AuthNMappingCreateData, required: Data for creating an AuthN Mapping.
    - `attributes` AuthNMappingCreateAttributes: Key/Value pair of attributes used for create request.
      - `attribute_key` string: Key portion of a key/value pair of the attribute sent from the Identity Provider.
      - `attribute_value` string: Value portion of a key/value pair of the attribute sent from the Identity Provider.
    - `relationships` union: Relationship of AuthN Mapping create object to a Role or Team.
      - AuthNMappingRelationshipToRole: Relationship of AuthN Mapping to a Role.
        - `role` RelationshipToRole, required: Relationship to role.
          - `data` RelationshipToRoleData: Relationship to role object.
            - `id` string: The unique identifier of the role.
            - `type` 'roles': Roles type.
      - AuthNMappingRelationshipToTeam: Relationship of AuthN Mapping to a Team.
        - `team` RelationshipToTeam, required: Relationship to team.
          - `data` RelationshipToTeamData: Relationship to Team object.
            - `id` string: The unique identifier of the team.
            - `type` 'team': Team type
    - `type` 'authn_mappings', required: AuthN Mappings resource type.

## Response `200`

OK

- AuthNMappingResponse: AuthN Mapping response from the API.
  - `data` AuthNMapping: The AuthN Mapping object returned by API.
    - `attributes` AuthNMappingAttributes: Attributes of AuthN Mapping.
      - `attribute_key` string: Key portion of a key/value pair of the attribute sent from the Identity Provider.
      - `attribute_value` string: Value portion of a key/value pair of the attribute sent from the Identity Provider.
      - `created_at` string, date-time: Creation time of the AuthN Mapping.
      - `modified_at` string, date-time: Time of last AuthN Mapping modification.
      - `saml_assertion_attribute_id` string: The ID of the SAML assertion attribute.
    - `id` string, required: ID of the AuthN Mapping.
    - `relationships` AuthNMappingRelationships: All relationships associated with AuthN Mapping.
      - `role` RelationshipToRole: Relationship to role.
        - `data` RelationshipToRoleData: Relationship to role object.
          - `id` string: The unique identifier of the role.
          - `type` 'roles': Roles type.
      - `saml_assertion_attribute` RelationshipToSAMLAssertionAttribute: AuthN Mapping relationship to SAML Assertion Attribute.
        - `data` RelationshipToSAMLAssertionAttributeData, required: Data of AuthN Mapping relationship to SAML Assertion Attribute.
          - `id` string, required: The ID of the SAML assertion attribute.
          - `type` 'saml_assertion_attributes', required: SAML assertion attributes resource type.
      - `team` RelationshipToTeam: Relationship to team.
        - `data` RelationshipToTeamData: Relationship to Team object.
          - `id` string: The unique identifier of the team.
          - `type` 'team': Team type
    - `type` 'authn_mappings', required: AuthN Mappings resource type.
  - `included` AuthNMappingIncluded[]: Included data in the AuthN Mapping response.
    - union: Included data in the AuthN Mapping response.
      - SAMLAssertionAttribute: SAML assertion attribute.
        - `attributes` SAMLAssertionAttributeAttributes: Key/Value pair of attributes used in SAML assertion attributes.
          - `attribute_key` string: Key portion of a key/value pair of the attribute sent from the Identity Provider.
          - `attribute_value` string: Value portion of a key/value pair of the attribute sent from the Identity Provider.
        - `id` string, required: The ID of the SAML assertion attribute.
        - `type` 'saml_assertion_attributes', required: SAML assertion attributes resource type.
      - Role: Role object returned by the API.
        - `attributes` RoleAttributes: Attributes of the role.
          - `created_at` string, date-time: Creation time of the role.
          - `modified_at` string, date-time: Time of last role modification.
          - `name` string: The name of the role. The name is neither unique nor a stable identifier of the role.
          - `receives_permissions_from` string[]: The managed role from which this role automatically inherits new permissions. Specify one of the following: "Datadog Admin Role", "Datadog Standard Role", or "Datadog Read Only Role". If empty or not specified, the role does not automatically inherit permissions from any managed role.
          - `user_count` integer: Number of users with that role.
        - `id` string: The unique identifier of the role.
        - `relationships` RoleResponseRelationships: Relationships of the role object returned by the API.
          - `permissions` RelationshipToPermissions: Relationship to multiple permissions objects.
            - `data` RelationshipToPermissionData[]: Relationships to permission objects.
              - …
        - `type` 'roles', required: Roles type.
      - AuthNMappingTeam: Team.
        - `attributes` AuthNMappingTeamAttributes: Team attributes.
          - `avatar` string, nullable: Unicode representation of the avatar for the team, limited to a single grapheme
          - `banner` integer, nullable: Banner selection for the team
          - `handle` string: The team's identifier
          - `link_count` integer: The number of links belonging to the team
          - `name` string: The name of the team
          - `summary` string, nullable: A brief summary of the team, derived from the `description`
          - `user_count` integer: The number of users belonging to the team
        - `id` string: The ID of the Team.
        - `type` 'team': Team type

## Other responses

- `400`: Bad Request
- `403`: Authentication Error
- `404`: Not Found
- `429`: Too many requests

---

[API](https://skmtc.dev/datadog/apis/datadog-api-v2-collection.md) - [All operations](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/llms.txt) - [OpenAPI document](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/revisions/da68bf029e4c?raw)
