> ## Documentation Index
> Fetch the complete documentation index at: https://developers.redo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# serviceUserApiKeyCreate

> Add an API key to a service account. Returns the key once. Returns null if the caller has no service account with that id.

**Required scopes:** [`user_write`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-user_write)

## Arguments

**input** `[ServiceUserCredentialCreateInput!](/docs/api-reference/v3/reference/service-users/service-user-credential-create-input)` *required*

**fields**

**name** `String!` *required*

A label that helps recognize the credential.

**serviceUserId** `ID!` *required*

The id of the service account to add it to.

## Returns

**serviceUserApiKeyCreate** `[ServiceUserApiKeyCreateResult](/docs/api-reference/v3/reference/service-users/service-user-api-key-create-result)`

A new API key, with its secret.

**fields**

**apiKey** `[ServiceUserApiKey!](/docs/api-reference/v3/reference/service-users/service-user-api-key)` *required*

The new key.

**fields**

**createdAt** `[DateTime!](/docs/api-reference/v3/reference/common/date-time)` *required*

When the credential was created.

**id** `ID!` *required*

The id of this credential.

**lastUsedAt** `[DateTime](/docs/api-reference/v3/reference/common/date-time)`

When the credential last authenticated, or null if it never has.

**name** `String!` *required*

A label that helps recognize the credential.

**suffix** `String!` *required*

The key's last four characters, to tell keys apart.

**secret** `String!` *required*

The key, returned only here. Store it now; it can't be shown again.

## Example

```graphql theme={null}
mutation {
  serviceUserApiKeyCreate(input: { ... }, serviceUserId: "...") {
    secret
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.