> For the complete documentation index, see [llms.txt](https://docs.amigo.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.amigo.ai/api-reference/readme/platform/external-auth-claim-mappings.md).

# External Auth Claim Mappings

## GET /v1/{workspace\_id}/external-auth-claim-mappings

> List Claim Mappings

```json
{"openapi":"3.1.0","info":{"title":"Platform API","version":"1.0.0"},"servers":[{"url":"https://api.platform.amigo.ai","description":"Production"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","description":"API key issued via `POST /v1/{workspace_id}/api-keys`. Pass the returned `api_key` value as a Bearer token."}},"schemas":{"src__routes__external_auth_claim_mappings__ListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ClaimMappingItem"},"type":"array","title":"Items"},"has_more":{"type":"boolean","title":"Has More"},"continuation_token":{"title":"Continuation Token"}},"type":"object","required":["items","has_more"],"title":"ListResponse"},"ClaimMappingItem":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"claim_namespace":{"type":"string","title":"Claim Namespace"},"claim_key":{"type":"string","title":"Claim Key"},"external_value":{"type":"string","title":"External Value"},"external_role_id":{"type":"string","format":"uuid","title":"External Role Id"},"status":{"type":"string","enum":["active","superseded"],"title":"Status"},"changed_by":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Changed By"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","claim_namespace","claim_key","external_value","external_role_id","status","created_at"],"title":"ClaimMappingItem"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v1/{workspace_id}/external-auth-claim-mappings":{"get":{"tags":["External Auth Claim Mappings"],"summary":"List Claim Mappings","operationId":"list-external-auth-claim-mappings","parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Workspace Id"}},{"name":"sort_by","in":"query","required":false,"schema":{"type":"array","items":{"type":"string"},"default":[],"title":"Sort By"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"exclusiveMinimum":0,"default":50,"title":"Limit"}},{"name":"continuation_token","in":"query","required":false,"schema":{"title":"Continuation Token"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"enum":["active","superseded"],"type":"string"},{"type":"null"}],"title":"Status"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/src__routes__external_auth_claim_mappings__ListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## POST /v1/{workspace\_id}/external-auth-claim-mappings

> Create Claim Mapping

```json
{"openapi":"3.1.0","info":{"title":"Platform API","version":"1.0.0"},"servers":[{"url":"https://api.platform.amigo.ai","description":"Production"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","description":"API key issued via `POST /v1/{workspace_id}/api-keys`. Pass the returned `api_key` value as a Bearer token."}},"schemas":{"src__routes__external_auth_claim_mappings__CreateRequest":{"properties":{"claim_namespace":{"type":"string","maxLength":64,"minLength":1,"pattern":"^[a-z][a-z0-9_.:-]{0,63}$","title":"Claim Namespace"},"claim_key":{"type":"string","maxLength":64,"minLength":1,"pattern":"^[a-z][a-z0-9_.:-]{0,63}$","title":"Claim Key"},"external_value":{"type":"string","maxLength":256,"minLength":1,"title":"External Value"},"external_role_id":{"type":"string","format":"uuid","title":"External Role Id"}},"additionalProperties":false,"type":"object","required":["claim_namespace","claim_key","external_value","external_role_id"],"title":"CreateRequest"},"ClaimMappingItem":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"claim_namespace":{"type":"string","title":"Claim Namespace"},"claim_key":{"type":"string","title":"Claim Key"},"external_value":{"type":"string","title":"External Value"},"external_role_id":{"type":"string","format":"uuid","title":"External Role Id"},"status":{"type":"string","enum":["active","superseded"],"title":"Status"},"changed_by":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Changed By"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","claim_namespace","claim_key","external_value","external_role_id","status","created_at"],"title":"ClaimMappingItem"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v1/{workspace_id}/external-auth-claim-mappings":{"post":{"tags":["External Auth Claim Mappings"],"summary":"Create Claim Mapping","operationId":"create-external-auth-claim-mapping","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/src__routes__external_auth_claim_mappings__CreateRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClaimMappingItem"}}}},"409":{"description":"An active mapping for this claim tuple already exists"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Workspace Id"}}]}}}}
```

## Resolve Preview Claim Mappings

> Dry-run the SAME resolver the per-turn path uses — read-only, never writes.\
> \
> Returns the mapped internal roles (id + name), the effective unioned active role\
> grants, and the count of unmapped input atoms. Requires \`\`Workspace.view\`\`.

```json
{"openapi":"3.1.0","info":{"title":"Platform API","version":"1.0.0"},"servers":[{"url":"https://api.platform.amigo.ai","description":"Production"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","description":"API key issued via `POST /v1/{workspace_id}/api-keys`. Pass the returned `api_key` value as a Bearer token."}},"schemas":{"ResolvePreviewRequest":{"properties":{"auth_claims":{"items":{"$ref":"#/components/schemas/ExternalAuthClaim"},"type":"array","maxItems":32,"title":"Auth Claims","default":[]}},"additionalProperties":false,"type":"object","title":"ResolvePreviewRequest"},"ExternalAuthClaim":{"properties":{"namespace":{"type":"string","maxLength":64,"pattern":"^[a-z][a-z0-9_.:-]{0,63}$","title":"Namespace"},"key":{"type":"string","maxLength":64,"pattern":"^[a-z][a-z0-9_.:-]{0,63}$","title":"Key"},"value":{"type":"string","maxLength":256,"minLength":1,"title":"Value"}},"additionalProperties":false,"type":"object","required":["namespace","key","value"],"title":"ExternalAuthClaim","description":"One normalized customer assertion: the exact tuple ``(namespace, key, value)``.\n\n``value`` is preserved byte-for-byte (bounded length only) — Amigo does not\nlowercase, alias, or rewrite it. ``namespace`` and ``key`` are bounded canonical\nidentifiers. Arrays, objects, numbers, booleans, and null are rejected for every\nfield (v1 values are non-empty strings)."},"ResolvePreviewResponse":{"properties":{"roles":{"items":{"$ref":"#/components/schemas/MappedRole"},"type":"array","title":"Roles"},"grants":{"items":{"$ref":"#/components/schemas/EffectiveGrant"},"type":"array","title":"Grants"},"unmapped_claim_count":{"type":"integer","title":"Unmapped Claim Count"}},"type":"object","required":["roles","grants","unmapped_claim_count"],"title":"ResolvePreviewResponse"},"MappedRole":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"name":{"type":"string","title":"Name"}},"type":"object","required":["id","name"],"title":"MappedRole"},"EffectiveGrant":{"properties":{"resource_type":{"$ref":"#/components/schemas/_ResourceType"},"resource_key":{"type":"string","title":"Resource Key"},"access":{"$ref":"#/components/schemas/_Access"}},"type":"object","required":["resource_type","resource_key","access"],"title":"EffectiveGrant"},"_ResourceType":{"type":"string","enum":["integration_endpoint","skill","kb_scope"]},"_Access":{"type":"string","enum":["read","write"]},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v1/{workspace_id}/external-auth-claim-mappings/resolve-preview":{"post":{"tags":["External Auth Claim Mappings"],"summary":"Resolve Preview Claim Mappings","description":"Dry-run the SAME resolver the per-turn path uses — read-only, never writes.\n\nReturns the mapped internal roles (id + name), the effective unioned active role\ngrants, and the count of unmapped input atoms. Requires ``Workspace.view``.","operationId":"resolve-preview-external-auth-claim-mappings","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResolvePreviewRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResolvePreviewResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Workspace Id"}}]}}}}
```

## GET /v1/{workspace\_id}/external-auth-claim-mappings/{mapping\_id}

> Get Claim Mapping

```json
{"openapi":"3.1.0","info":{"title":"Platform API","version":"1.0.0"},"servers":[{"url":"https://api.platform.amigo.ai","description":"Production"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","description":"API key issued via `POST /v1/{workspace_id}/api-keys`. Pass the returned `api_key` value as a Bearer token."}},"schemas":{"ClaimMappingItem":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"claim_namespace":{"type":"string","title":"Claim Namespace"},"claim_key":{"type":"string","title":"Claim Key"},"external_value":{"type":"string","title":"External Value"},"external_role_id":{"type":"string","format":"uuid","title":"External Role Id"},"status":{"type":"string","enum":["active","superseded"],"title":"Status"},"changed_by":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Changed By"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","claim_namespace","claim_key","external_value","external_role_id","status","created_at"],"title":"ClaimMappingItem"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v1/{workspace_id}/external-auth-claim-mappings/{mapping_id}":{"get":{"tags":["External Auth Claim Mappings"],"summary":"Get Claim Mapping","operationId":"get-external-auth-claim-mapping","parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Workspace Id"}},{"name":"mapping_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Mapping Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClaimMappingItem"}}}},"404":{"description":"External auth claim mapping not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Supersede Claim Mapping

> Supersede an active mapping (immutable history) — flip active → superseded.\
> \
> POST verb (not DELETE): the row persists and the superseded item is returned so\
> the caller sees the final state. 404 if there is no active row for the id.

```json
{"openapi":"3.1.0","info":{"title":"Platform API","version":"1.0.0"},"servers":[{"url":"https://api.platform.amigo.ai","description":"Production"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","description":"API key issued via `POST /v1/{workspace_id}/api-keys`. Pass the returned `api_key` value as a Bearer token."}},"schemas":{"ClaimMappingItem":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"claim_namespace":{"type":"string","title":"Claim Namespace"},"claim_key":{"type":"string","title":"Claim Key"},"external_value":{"type":"string","title":"External Value"},"external_role_id":{"type":"string","format":"uuid","title":"External Role Id"},"status":{"type":"string","enum":["active","superseded"],"title":"Status"},"changed_by":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Changed By"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","claim_namespace","claim_key","external_value","external_role_id","status","created_at"],"title":"ClaimMappingItem"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v1/{workspace_id}/external-auth-claim-mappings/{mapping_id}/supersede":{"post":{"tags":["External Auth Claim Mappings"],"summary":"Supersede Claim Mapping","description":"Supersede an active mapping (immutable history) — flip active → superseded.\n\nPOST verb (not DELETE): the row persists and the superseded item is returned so\nthe caller sees the final state. 404 if there is no active row for the id.","operationId":"supersede-external-auth-claim-mapping","parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Workspace Id"}},{"name":"mapping_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Mapping Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClaimMappingItem"}}}},"404":{"description":"Active external auth claim mapping not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.amigo.ai/api-reference/readme/platform/external-auth-claim-mappings.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
