> ## Documentation Index
> Fetch the complete documentation index at: https://nemonist.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Workload identity

> CI jobs and cloud workloads get a one-hour key from their own identity token, so no long-lived key is stored in CI.

Workload Identity Federation comes with the Teams and Enterprise plans. Set it up under **Security**, **Workload identity**.

## Add a policy

A workload whose OIDC token has the policy's issuer and audience, and a subject that matches, gets a key that works for one hour in the workspace, acting as you. Add one policy for each repository or workload:

| Field | Value |
| - | - |
| Issuer | The token's `iss`, an https URL. For GitHub Actions: `https://token.actions.githubusercontent.com`. |
| Audience | The token's `aud`; for GitHub Actions, the audience you request the token with, such as `https://nemonist.com`. |
| Subject | The token's `sub`, exactly, or with `*` for any characters, for example `repo:acme/api:ref:refs/heads/main` or `repo:acme/api:*`. |

Deleting a policy stops its keys at once.

## Exchange a token in GitHub Actions

The job needs `permissions: id-token: write`. Use the policy ID shown on the page:

```bash theme={null}
TOKEN=$(curl -sH "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
  "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=https://nemonist.com" | jq -r .value)
NEMONIST_API_KEY=$(curl -s https://nemonist.com/backend/nemonist.v1.WorkloadIdentityService/ExchangeToken \
  -H 'content-type: application/json' \
  -d "{\"policyId\":\"<policy id>\",\"token\":\"$TOKEN\"}" | jq -r .key)
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.