---
title: "Create a new service account authentication config"
method: POST
path: "/api/v2/service-accounts/{service_account_id}/auth-config"
tags: ["Service Accounts"]
---

# Create a new service account authentication config

`POST /api/v2/service-accounts/{service_account_id}/auth-config`

## Request

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

Creates a new authentication configuration for a service account.

## Path parameters

- `service_account_id` string, byte, required

## Headers

- `x-org-id` string

## Request body

- object
  - `authConfig` JumpcloudServiceAccountsAuthConfigParameter: 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

## Response `200`

A successful response.

- JumpcloudServiceAccountsCreateAuthConfigResponse
  - `authConfig` JumpcloudServiceAccountsAuthConfig: Contains authentication configuration, such as Client Secret or API key config.
    - `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'

## Other responses

- `201`: Created
- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found
- `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)
