Overview
The API key endpoints manage the credentials for a project. An API key and its secret let your own server sign access tokens, which clients use to join rooms. You can also skip the secret and have LiveKit create a token for you.
A project has the following kinds of key. They grant the same full access to the project, and differ only in who owns them:
- A personal key belongs to the member who generated it. When you generate a key, you get a personal key by default.
- A service account key has no owner. Set
isServiceAccounttotruewhen you generate it. - An agent key belongs to a cloud agent. LiveKit creates these for you, and listing keys leaves them out unless you set
includeAgentKeys.
Key ownership determines what happens when someone loses access. Removing a member revokes the personal keys they own, but service account and agent keys remain valid. Use a service account key for a production server, CI, or anything else that must keep running after a person leaves. To learn more, see Project members.
When you generate a key, the response includes the secret only once. Store it right away. To replace a lost secret, delete the key and generate another. To list the keys of one member, set ownerId to their user ID.
When you create a token, LiveKit signs it with the oldest key of the project that isn't an agent key. If the project has no such key, the request returns 400. A token lasts 10 minutes by default, and 24 hours at most.
Listing, generating, and deleting keys need the Admin role on the project.
To create a token, your role must permit every grant in the request. When the grants need different roles, you need the highest one:
| Grants | Required role |
|---|---|
| Inference | Read |
| Room, room management, agent dispatch, agent endpoint, agent thread, SIP, and simulation | Write |
Recording, ingress, agent.admin, agent.databaseAdmin, and observability | Admin |
To call these endpoints from the CLI, use the lk project key commands, for example lk project key list --user-auth. The lk token create --user-auth command creates a token the same way.
The access key object
The metadata of a project API key. A list never includes the secret. Only GenerateKey returns it.
apiKeystringThe API key ID (API...). The secret is returned only when the key is generated.
createdAttimestampWhen the key was generated.
updatedAttimestampWhen the key was last changed.
descriptionstringA label for the key.
ownerIdstringThe user who owns the key. Empty for a key with no owner, such as a service account key.
ownerEmailstringThe email address of the owner. Empty for a key with no owner.
agentIdstringThe cloud agent that the key belongs to. Set only for agent keys.
List keys
/v0/projects/{projectId}/keysLists the API keys of a project, oldest first. The list does not include the secrets.
Returns a list of AccessKey objects, with a pageInfo cursor.
Path parameters
projectIdstringThe project ID (p_...).
Query parameters
includeAgentKeysbooleanWhen true, the list includes the keys of cloud agents. By default, the list does not include them.
page.cursorstringThe cursor of the page to return: the nextCursor of the previous page. When empty, the list starts at the first item.
page.pageSizeint32The maximum number of items to return. When 0, the list uses its default page size.
ownerIdstringThe ID of a user. Returns only the keys that this user owns. When empty, returns the keys of every owner and the keys with no owner.
Generate key
/v0/projects/{projectId}/keysCreates an API key and secret for the project. The response includes the secret. You cannot read the secret again.
Path parameters
projectIdstringThe project ID (p_...).
Request body
descriptionstringA label for the key.
isServiceAccountbooleanWhen true, the key has no owner, and it belongs to the project. ListKeys with an ownerId does not return it, and it stays when the user who created it leaves the project.
Response fields
apiKeystringThe apiKey value.
secretstringThe secret value.
Delete key
/v0/projects/{projectId}/keys/{apiKey}Path parameters
projectIdstringThe project ID (p_...).
apiKeystringThe API key ID (API...).
Create token
/v0/projects/{projectId}/tokensCreates a short-lived LiveKit access token for the project. The API signs the token, so a signed-in user can call the LiveKit server APIs, such as rooms, SIP, and egress, or join a room without an API secret.
Path parameters
projectIdstringThe project ID (p_...).
Request body
grantsTokenGrantsThe grants of the token. Your project role must cover every grant that you request.
To learn more, see TokenGrants.
ttlSecondsintegerThe token lifetime, in seconds. 0 means the default, 10 minutes. The maximum is 86400 (24 hours). A larger value returns InvalidArgument.
Response fields
tokenstringThe signed JWT. Depending on the grants, send it as Authorization: Bearer to the server APIs of the project, or use it to join a room.
expiresAttimestampThe expiresAt value.
Types
Types used by these endpoints, alongside the access key object.
Agent
The permissions for the agent server API.
adminbooleanCreate, update, and delete cloud agents.
simulationAdminbooleanManage the simulations and scenarios that evaluate an agent.
databaseAdminbooleanReach the agent databases of the project.
dispatchAdminbooleanManage the agent dispatch queue of the project.
AgentEndpoint
The permission to call the non-public HTTP endpoints of an agent.
callbooleanCall the endpoints.
agentNamestringThe name of one agent. When empty, the grant applies to every agent of the project.
deploymentstringOne deployment of the agent. When empty, the grant applies to every deployment.
AgentThread
The permissions of a thread token. The token can list and create threads in scope. It can read, write, and delete the threads in threadIds, for example for a frontend that shows one conversation. When all is true, the token can act on every thread of the project. The action flags still apply.
scopestringThe scope the list and create permissions apply to.
threadIdsArray<string>The threads the read, write, and delete permissions apply to.
listbooleanList the threads in scope.
createbooleanCreate a thread in scope.
writebooleanWrite the threads in threadIds.
readbooleanRead the threads in threadIds.
deletebooleanDelete the threads in threadIds.
allbooleanExtend the read, write, and delete permissions to every thread of the project.
Inference
performbooleanEvery inference feature: LLM, STT, and TTS.
Observability
writebooleanPublish observability data.
Sip
The permissions for the SIP server API.
adminbooleanEvery SIP feature.
callbooleanMake outbound SIP calls.
TokenGrants
The claims of a LiveKit access token. The field names match the JSON claims of the token, so the claims JSON of a token is a valid TokenGrants.
identitystringThe identity of the participant: the subject of the token.
namestringThe display name of the participant.
kindstringThe kind of participant: standard, ingress, egress, sip, or agent.
kindDetailsArray<string>The kindDetails value.
videoVideoRoom and participant permissions.
To learn more, see Video.
sipSipSIP server API permissions.
To learn more, see Sip.
agentAgentAgent server API permissions.
To learn more, see Agent.
inferenceInferenceInference permissions.
To learn more, see Inference.
observabilityObservabilityObservability permissions.
To learn more, see Observability.
roomConfigRoomConfigurationThe configuration of a room that this participant creates when it joins, with its agent dispatches.
To learn more, see RoomConfiguration.
roomPresetstringThe name of a LiveKit Cloud room configuration preset. The fields in roomConfig override it.
metadatastringMetadata carried on the participant.
attributesMap<string, string>Attributes carried on the participant.
agentEndpointAgentEndpointPermission to call an agent's non-public HTTP endpoints.
To learn more, see AgentEndpoint.
agentThreadAgentThreadAgent thread permissions.
To learn more, see AgentThread.
Video
The room and participant permissions.
roomCreatebooleanWhen true, the token can create rooms with the server API.
roomListbooleanWhen true, the token can list rooms with the server API.
roomRecordbooleanWhen true, the token can start and manage egress with the server API.
roomAdminbooleanWhen true, the token can manage room with the server API. When room is empty, the token can manage every room.
roomJoinbooleanWhen true, the participant can join room.
roomstringThe room the join and admin permissions apply to. Required when either is set.
canPublishbooleanWhen true, the participant can publish tracks. Unset means true.
canSubscribebooleanSubscribe to tracks. Unset means allowed.
canPublishDatabooleanPublish data to the room. Unset means allowed.
canPublishSourcesArray<string>The sources that the participant can publish, such as camera and microphone.
canUpdateOwnMetadatabooleanUpdate the participant's own metadata. Unset means allowed.
ingressAdminbooleanWhen true, the token can manage ingress with the server API.
recorderbooleanTell the room the participant is a recorder.
agentbooleanRegister as an Agents framework worker.
canSubscribeMetricsbooleanSubscribe to metrics.
canManageAgentSessionbooleanManage an agent session through RemoteSession.
destinationRoomstringThe room to move or forward participants to.