---
title: "Create a new access key for a service account."
method: POST
path: "/v1/serviceAccounts/{serviceAccountId}/accessKeys"
tags: ["serviceAccountManagement"]
---

# Create a new access key for a service account.

`POST /v1/serviceAccounts/{serviceAccountId}/accessKeys`

Creates a new access ID and key pair for a service account.

## Path parameters

- `serviceAccountId` string, required

## Request body

- AccessKeyCreateRequest
  - `label` string, required — A name for the access key to be created.
  - `corsHeaders` string[] — An array of domains for which the access key is valid. Whether Sumo Logic accepts or rejects an API request depends on whether it contains an ORIGIN header and the entries in the allowlist. Sumo Logic will reject: 1. Requests with an ORIGIN header but the allowlist is empty. 2. Requests with an ORIGIN header that don't match any entry in the allowlist.
  - `scopes` string[] — Scopes assigned to the key. ### Alerting - adminMonitorsV2 - viewMonitorsV2 - manageMonitorsV2 ### Data Management - manageApps - viewCollectors - manageCollectors - viewConnections - manageConnections - contentAdmin - viewFieldExtractionRules - manageFieldExtractionRules - viewFields - manageFields - manageBudgets - viewLibrary - manageLibrary - viewPartitions - managePartitions - manageS3DataForwarding - viewScheduledViews - manageScheduledViews - manageTokens ### Logs - runLogSearch ### Metrics - runMetricsQuery ### Reliability Management - viewSlos - manageSlos ### Security - manageAccessKeys - viewPersonalAccessKeys - managePersonalAccessKeys ### UserManagement - viewUsersAndRoles - manageUsersAndRoles

## Response `200`

The access key has been created for a service account.

- AccessKey
  - `id` string, required — Identifier of the access key.
  - `label` string, required — The name of the access key.
  - `corsHeaders` string[] — An array of domains for which the access key is valid. Whether Sumo Logic accepts or rejects an API request depends on whether it contains an ORIGIN header and the entries in the allowlist. Sumo Logic will reject: 1. Requests with an ORIGIN header but the allowlist is empty. 2. Requests with an ORIGIN header that don't match any entry in the allowlist.
  - `disabled` boolean, required — Indicates whether the access key is disabled or not.
  - `createdAt` string, date-time, required — Creation timestamp in UTC in [RFC3339](https://tools.ietf.org/html/rfc3339) format.
  - `createdBy` string, required — Identifier of the user who created the access key.
  - `modifiedAt` string, date-time, required — Last modification timestamp in UTC.
  - `modifiedBy` string, required — Identifier of the user who modified the access key.
  - `serviceAccountId` string — Identifier of the service account who owns the access key.
  - `lastUsed` string, date-time — Last used timestamp in UTC. <br> **Note:** Property not in use, it is part of an upcoming feature.
  - `scopes` string[] — Scopes assigned to the key. ### Alerting - adminMonitorsV2 - viewMonitorsV2 - manageMonitorsV2 ### Data Management - manageApps - viewCollectors - manageCollectors - viewConnections - manageConnections - contentAdmin - viewFieldExtractionRules - manageFieldExtractionRules - viewFields - manageFields - manageBudgets - viewLibrary - manageLibrary - viewPartitions - managePartitions - manageS3DataForwarding - viewScheduledViews - manageScheduledViews - manageTokens ### Logs - runLogSearch ### Metrics - runMetricsQuery ### Reliability Management - viewSlos - manageSlos ### Security - manageAccessKeys - viewPersonalAccessKeys - managePersonalAccessKeys ### UserManagement - viewUsersAndRoles - manageUsersAndRoles
  - `effectiveScopes` string[] — Effective scopes based on the intersection of the user's RBAC capabilities and the assigned scopes.
  - `key` string, required — The key for the created access key. This field will have values only in the response for an access key create request. The value will be an empty string while listing all keys.

## Other responses

- `default` — Operation failed with an error.

---

[API](https://skmtc.net/sumologic/apis/sumo-logic-api.md) · [All operations](https://skmtc.net/sumologic/apis/sumo-logic-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/sumologic/sumo-logic-api/revisions/18a824df1e78/schema)
