Create project service account

POSThttps:/api.openai.com/v1/organization/projects/{project_id}/service_accounts

Creates a new service account in the project. This also returns an unredacted API key for the service account.

Path parameters

  • project_id
    string
    Required
    The ID of the project.

Request body

  • name
    string
    Required
    The name of the service account being created.

Response

The created ProjectServiceAccount object.

Example request
1
curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/service_accounts \
2
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
3
-H "Content-Type: application/json" \
4
-d '{
5
"name": "Production App"
6
}'
Example response
1
{
2
"object": "organization.project.service_account",
3
"id": "svc_acct_abc",
4
"name": "Production App",
5
"role": "member",
6
"created_at": 1711471533,
7
"api_key": {
8
"object": "organization.project.service_account.api_key",
9
"value": "sk-abcdefghijklmnop123",
10
"name": "Secret Key",
11
"created_at": 1711471533,
12
"id": "key_abc"
13
}
14
}
Built with