---
title: "Create a new service account"
method: POST
path: "/api/v2/service-accounts"
tags: ["Service Accounts"]
---

# Create a new service account

`POST /api/v2/service-accounts`

## Request

- Base URL: `https://console.jumpcloud.com`
- URL: `https://console.jumpcloud.com/api/v2/service-accounts`
- Auth: API key in header `x-api-key`
- TypeScript: <https://skmtc.dev/jumpcloud/apis/jumpcloud-console-api/docs/api/v2/service-accounts/post.ts> (a function with typed inputs; its response is checked against the schema)

Creates a new service account.

## Headers

- `x-org-id` string

## Request body

- JumpcloudServiceAccountsCreateServiceAccountRequest
  - `authConfig` JumpcloudServiceAccountsAuthConfigParameter, required: Contains the configuration parameters required for the creation of auth config.
    - `apiKeyConfig` JumpcloudServiceAccountsApiKeyConfigParam
      - `lifetime` string, required
    - `authType` 'AUTH_TYPE_UNSPECIFIED' | 'CLIENT_SECRET' | 'API_KEY', required: - AUTH_TYPE_UNSPECIFIED: unspecified authentication type - CLIENT_SECRET: client secret authentication - API_KEY: API key authentication (jcs_* direct org)
    - `clientSecretConfig` JumpcloudServiceAccountsClientSecretConfigParam
      - `lifetime` string, required
  - `name` string, required
  - `roleId` string, byte, required
  - `roleName` string: DEPRECATED: the role name is ignored. Use role_id instead.

## Response `200`

A successful response.

- JumpcloudServiceAccountsCreateServiceAccountResponse
  - `serviceAccount` JumpcloudServiceAccountsServiceAccount
    - `authConfigList` JumpcloudServiceAccountsAuthConfig[]
      - `apiKeyConfig` JumpcloudServiceAccountsApiKeyConfig: contains configuration for an API key auth config (prefix on read; full key once on create).
        - `apiKey` string
        - `apiKeyPrefix` string
        - `createdAt` string, date-time
        - `createdBy` JumpcloudServiceAccountsServiceAccountActor
          - `id` string, byte
          - `name` string
          - `type` 'ADMIN' | 'SERVICE_ACCOUNT': - ADMIN: the actor is admin - SERVICE_ACCOUNT: the actor is a service account
        - `expiresAt` string, date-time
        - `lifetime` string
        - `objectId` string, byte
        - `status` 'ACTIVE' | 'EXPIRED' | 'EXPIRING'
      - `authType` 'AUTH_TYPE_UNSPECIFIED' | 'CLIENT_SECRET' | 'API_KEY': - AUTH_TYPE_UNSPECIFIED: unspecified authentication type - CLIENT_SECRET: client secret authentication - API_KEY: API key authentication (jcs_* direct org)
      - `clientSecretConfig` JumpcloudServiceAccountsClientSecretConfig
        - `clientId` string
        - `clientSecret` string: client secret associated with the client ID. This field will hold the secret only at the time of creation and will be visible to users only once. The subsequent retrievals will not return the secret for security reasons.
        - `createdAt` string, date-time
        - `createdBy` JumpcloudServiceAccountsServiceAccountActor
          - `id` string, byte
          - `name` string
          - `type` 'ADMIN' | 'SERVICE_ACCOUNT': - ADMIN: the actor is admin - SERVICE_ACCOUNT: the actor is a service account
        - `expiresAt` string, date-time
        - `lifetime` string
        - `objectId` string, byte
        - `status` 'ACTIVE' | 'EXPIRED' | 'EXPIRING'
    - `authType` 'AUTH_TYPE_UNSPECIFIED' | 'CLIENT_SECRET' | 'API_KEY': - AUTH_TYPE_UNSPECIFIED: unspecified authentication type - CLIENT_SECRET: client secret authentication - API_KEY: API key authentication (jcs_* direct org)
    - `createdAt` string, date-time
    - `expiresAt` string, date-time
    - `name` string
    - `objectId` string, byte
    - `orgCount` integer
    - `orgId` string, byte
    - `providerId` string, byte
    - `roleId` string, byte
    - `roleName` string: DEPRECATED: Call roles API with the role_id to get the role name.
    - `status` 'ACTIVE' | 'EXPIRED' | 'EXPIRING'

## Other responses

- `201`: Service account successfully created.
- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found
- `409`: Conflict
- `500`: Internal Server Error
- `503`: Service Unavailable

---

[API](https://skmtc.dev/jumpcloud/apis/jumpcloud-console-api.md) - [All operations](https://skmtc.dev/jumpcloud/apis/jumpcloud-console-api/llms.txt) - [OpenAPI document](https://skmtc.dev/jumpcloud/apis/jumpcloud-console-api/revisions/f396d9271b46?raw)
