---
title: "POST /api/organizations/{organization_pk}/serviceaccounts/"
method: POST
path: "/api/organizations/{organization_pk}/serviceaccounts/"
tags: ["organizations"]
---

# POST /api/organizations/{organization_pk}/serviceaccounts/

`POST /api/organizations/{organization_pk}/serviceaccounts/`

Create a new service account in an organization with the given label and role, and return it together with a one-time API token for authenticating as that account.

## Path parameters

- `organization_pk` string, required

## Request body

- ServiceAccountWithToken
  - `id` string, uuid
  - `name` string, required
  - `role` 1 | 2 | 3 | 4 | 5
  - `created_at` string, date-time
  - `last_active_at` string, date-time, nullable — The last time the user was active. Currently only set for service accounts and support service accounts.
  - `token` string

## Response `201`

---

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