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

# createCompanyApiKey

> Creates a company API key and returns its token, once. The key can never do more than the calling key. Rotate a key by creating its successor, then revoking it. Needs a company API key with `api_keys:write`.



**mutation** `createCompanyApiKey(input: CreateCompanyApiKeyInput!): CreateCompanyApiKeyPayload!`

## Arguments

**`input`**: `CreateCompanyApiKeyInput!` (required)

The key to create.

## Returns

`CreateCompanyApiKeyPayload!`

**`companyApiKey`**: `CompanyApiKey!`

The new key.

---

**`token`**: `String!`

The key's bearer token. This is the only time it is shown; store it now.

## Examples

```graphql Mutation
mutation CreateCompanyApiKey($input: CreateCompanyApiKeyInput!) {
  createCompanyApiKey(input: $input) {
    companyApiKey {
      id
      name
      capabilities
      workspaces {
        edges {
          __typename
        }
        pageInfo {
          __typename
        }
        totalCount
      }
      createdAt
      expiresAt
    }
    token
  }
}
```

```json Variables
{
  "input": {
    "name": "string",
    "capabilityGroups": [
      "VIEW_AUDIT_LOGS"
    ],
    "workspaceUids": [
      "string"
    ]
  }
}
```

```json Response
{
  "data": {
    "createCompanyApiKey": {
      "companyApiKey": {
        "id": "id",
        "name": "string",
        "capabilities": [
          "string"
        ],
        "workspaces": {
          "edges": [
            {
              "__typename": "WorkspaceEdge"
            }
          ],
          "pageInfo": {
            "__typename": "PageInfo"
          },
          "totalCount": 1
        },
        "createdAt": "value",
        "expiresAt": "value"
      },
      "token": "string"
    }
  }
}
```


## Related topics

- [Administration API: API keys](https://docs.paradime.io/developers/graphql-api/admin-api/api-keys.md)
- [Administration API: Conventions](https://docs.paradime.io/developers/graphql-api/admin-api/conventions.md)
- [Administration API](https://docs.paradime.io/developers/graphql-api/admin-api/index.md)
- [API Keys](https://docs.paradime.io/developers/api-keys.md)
- [Onboard a workspace with the API](https://docs.paradime.io/guides/set-up-and-configure/onboard-a-workspace-with-the-api.md)


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