Project service accounts
Manage service accounts within a project. A service account is a bot user that is not associated with a user. If a user leaves an organization, their keys and membership in projects will no longer work. Service accounts do not have this limitation. However, service accounts can also be deleted from a project.
List project service accounts
Returns a list of service accounts in the project.
Query parameters
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
Returns
A list of ProjectServiceAccount objects.
1
2
3
curl https://api.openai.com/v1/organization/projects/proj_abc/service_accounts?after=custom_id&limit=20 \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Create project service account
Creates a new service account in the project. This also returns an unredacted API key for the service account.
Returns
The created ProjectServiceAccount object.
1
2
3
4
5
6
curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/service_accounts \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Production App"
}'
Retrieve project service account
Retrieves a service account in the project.
Path parameters
Returns
The ProjectServiceAccount object matching the specified ID.
1
2
3
curl https://api.openai.com/v1/organization/projects/proj_abc/service_accounts/svc_acct_abc \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Delete project service account
Deletes a service account from the project.
Path parameters
Returns
Confirmation of service account being deleted, or an error in case of an archived project, which has no service accounts
1
2
3
curl -X DELETE https://api.openai.com/v1/organization/projects/proj_abc/service_accounts/svc_acct_abc \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
The project service account object
Represents an individual service account in a project.
1
2
3
4
5
6
7
{
"object": "organization.project.service_account",
"id": "svc_acct_abc",
"name": "Service Account",
"role": "owner",
"created_at": 1711471533
}