---
title: Create a service account
description: Creates a service account.
doc_version: 0.1.0-preview
last_updated: 2026-09-14
---

# Create a service account

`POST /v1/workspaces/{workspaceId}/service-accounts`

Creates a service account. Requires an admin key. The default role is viewer. Creation does not issue an API key.

## Authentication

Send `Authorization: Bearer <SPARK_API_KEY>`. Read the key from the
SPARK_API_KEY environment variable. Never print it.

## Path parameters

- `workspaceId` (string) — The workspace id.

## Request body

- `name` (string) — Display name.
- `description` (string (optional)) — Optional notes.
- `role` (string (optional)) — Workspace role for keys this account owns. Defaults to viewer. One of: viewer, editor, admin.

## Example request

```bash
curl \
  --url "https://api.beta.graphon.ai/v1/workspaces/wspQ7WsH2Np5L/service-accounts" \
  --header "Authorization: Bearer $SPARK_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{"name":"CI runner","description":"Deploys from GitHub Actions.","role":"viewer"}'
```

## Example response

```json
{
  "id": "sacD4e5F6g7H8",
  "workspaceId": "wspQ7WsH2Np5L",
  "name": "CI runner",
  "description": "Deploys from GitHub Actions.",
  "role": "viewer",
  "status": "active",
  "createdBy": "usrB2c3D4e5F6",
  "createdByName": "Ada Lovelace",
  "createdAt": "2026-09-14T18:00:00.000Z",
  "keyCount": 0,
  "revision": 1
}
```

## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
