---
title: "Creates a new service account in the project. This also returns an unredacted API key for the service account."
method: POST
path: "/organization/projects/{project_id}/service_accounts"
tags: ["Projects"]
---

# 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

## Request body

- ProjectServiceAccountCreateRequest
  - `name` string, required — The name of the service account being created.

## Response `200`

Project service account created successfully.

- ProjectServiceAccountCreateResponse
  - `object` 'organization.project.service_account', required
  - `id` string, required
  - `name` string, required
  - `role` 'member', required — Service accounts can only have one role of type `member`
  - `created_at` integer, required
  - `api_key` ProjectServiceAccountApiKey, required
    - `object` 'organization.project.service_account.api_key', required — The object type, which is always `organization.project.service_account.api_key`
    - `value` string, required
    - `name` string, required
    - `created_at` integer, required
    - `id` string, required

## Other responses

- `400` — Error response when project is archived.

## Changes

- **2024-08-06** `c36d30a94622` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/openai/apis/openai-api-2/changes/organization/projects/:project_id/service_accounts/post.md)

---

[API](https://skmtc.dev/openai/apis/openai-api-2.md) · [All operations](https://skmtc.dev/openai/apis/openai-api-2/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/openai/openai-api-2/revisions/2f8ca92b9b18/schema)
