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

POST /organization/projects/{project_id}/service_accounts

Path parameters

  • project_id string Required

    The ID of the project.

application/json

Body Required

The project service account create request payload.

  • name string Required

    The name of the service account being created.

Responses

  • 200 application/json

    Project service account created successfully.

    Hide response attributes Show response attributes object
    • object string Required

      Value is organization.project.service_account.

    • id string Required
    • name string Required
    • role string Required

      Service accounts can only have one role of type member

      Value is member.

    • created_at integer Required
    • api_key object Required
      Hide api_key attributes Show api_key attributes object
      • object string Required

        The object type, which is always organization.project.service_account.api_key

        Value is organization.project.service_account.api_key.

      • value string Required
      • name string Required
      • created_at integer Required
      • id string Required
  • 400 application/json

    Error response when project is archived.

    Hide response attribute Show response attribute object
    • error object Required
      Hide error attributes Show error attributes object
      • code string | null Required
      • message string Required
      • param string | null Required
      • type string Required
POST /organization/projects/{project_id}/service_accounts
curl \
 --request POST 'https://api.openai.com/v1/organization/projects/{project_id}/service_accounts' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{"name":"string"}'
Request examples
{
  "name": "string"
}
Response examples (200)
{
  "object": "organization.project.service_account",
  "id": "string",
  "name": "string",
  "role": "member",
  "created_at": 42,
  "api_key": {
    "object": "organization.project.service_account.api_key",
    "value": "string",
    "name": "string",
    "created_at": 42,
    "id": "string"
  }
}
Response examples (400)
{
  "error": {
    "code": "string",
    "message": "string",
    "param": "string",
    "type": "string"
  }
}