# Create API Key

Create a new API key for your company. Choose its permissions; each must be one the calling key holds and its creator still holds, so a key can never mint a stronger key. Without permissions or accessLevel, the new key gets the view permissions. The key itself appears only in this response, so store it right away; MindCloud keeps only a hash.

`POST https://connect.mindcloud.co/v2/api-keys`

Permissions: `api_key:manage`.

## Parameters

### Headers

- `X-Company-Id` (string): Optional. The id of the organization to act in. Leave it out to act in the API key's own organization. Here a key acts in another organization only as one of its members: with "Use this key across all of your organizations" on, in an organization its creator belongs to with a role. Child organizations and MindCloud staff access do not reach this endpoint. Every response's X-Company-Id header names the organization it acted in. See [Organizations](https://mindcloud.co/docs/api/rest/introduction/organizations).

### Body

- `name` (string, required): A name that tells you later what the key is for, up to 256 characters.
- `permissions` (array): The permissions the new key holds, for example ["workflow:view","log:view"]. Defaults to the view permissions.
  Allowed values:
    - `workflow:view`: Workflows: View workflows.
    - `workflow:create`: Workflows: Create workflows.
    - `workflow:edit`: Workflows: Edit workflows.
    - `workflow:delete`: Workflows: Delete workflows.
    - `workflow:run`: Workflows: Run and cancel workflows.
    - `log:view`: Runs: View runs and logs.
    - `credential:view`: Connections: View connections.
    - `credential:create`: Connections: Create connections and connect links.
    - `credential:edit`: Connections: Edit, reconnect, and test connections.
    - `credential:delete`: Connections: Delete connections.
    - `universal:read`: Universal API: Run read actions and lookups.
    - `universal:create`: Universal API: Run create actions.
    - `universal:update`: Universal API: Run update actions.
    - `universal:delete`: Universal API: Run delete actions.
    - `member:view`: Members and roles: View members and roles.
    - `member:create`: Members and roles: Invite members.
    - `member:edit`: Members and roles: Change member roles.
    - `member:delete`: Members and roles: Remove members.
    - `member:owner_edit`: Members and roles: Invite, change, or remove Owners.
    - `role:manage`: Members and roles: Create, edit, and delete roles.
    - `company:view`: Company: View company and environments.
    - `company:edit`: Company: Edit company profile.
    - `environment:edit`: Company: Create, edit, and delete environments.
    - `company:parent:manage`: Company: Accept, decline, or leave a parent organization.
    - `subscription:view`: Company: View usage and spend limits.
    - `subscription:manage`: Company: Set member spend limits.
    - `api_key:manage`: API keys: See and revoke all API keys.
    - `embedded:view`: Embedded: View end users and their connections.
    - `embedded:create`: Embedded: Create end users and connect links.
    - `embedded:edit`: Embedded: Edit end users.
    - `embedded:delete`: Embedded: Delete end users.
    - `analytics:page:view`: Analytics: View Analytics pages, panels and data sources.
    - `analytics:page:create`: Analytics: Create Analytics pages and manage data sources, publications, themes, folder shares and template installs.
    - `analytics:page:edit`: Analytics: Edit, publish, share and delete Analytics pages.
    - `child_company:access`: Child organizations: Act in child organizations.
    - `child_company:manage`: Child organizations: Create, link, release, and close child organizations.
- `accessLevel` (string): Instead of permissions: read_only, run_workflows, or full_access, which give that level's permissions. Send one of permissions and accessLevel, not both.
  Allowed values:
    - `read_only`
    - `run_workflows`
    - `full_access`
- `isAllOrganizations` (boolean): true: "Use this key across all of your organizations". The new key can act, through X-Company-Id, in every organization its creator can open in the app. Only a calling key that has it may give it, so a key can never mint one that reaches further than itself.
  "Use this key across all of your organizations". Only a key that has it may give it.

## Example request

```bash
curl --request POST \
  --url 'https://connect.mindcloud.co/v2/api-keys' \
  --header 'Authorization: Bearer $MINDCLOUD_API_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "Reporting",
  "permissions": [
    "workflow:view",
    "log:view"
  ],
  "accessLevel": "read_only",
  "isAllOrganizations": false
}'
```

## Response fields

- `id` (string): Unique id of the key.
- `name` (string): The name the key was created with.
- `accessLevel` (string): A summary of the key permissions: full_access, run_workflows, read_only, or none. Derived from permissions; it is never set directly.
  Allowed values:
    - `read_only`
    - `run_workflows`
    - `full_access`
    - `none`
- `isAllOrganizations` (boolean): "Use this key across all of your organizations": the key can act, through X-Company-Id, in every organization its creator can open in the app, with no more than the creator may do there.
- `permissions` (array of string): The permissions the key holds. A request may use one only while the key's creator also holds it.
- `key` (string): The key itself, such as `mc-us1-…`. It appears only in this response; MindCloud keeps only a hash.
- `createdOn` (date): When the key was created.

## Example response

```json
{
  "success": true,
  "data": {
    "id": "apikey_K7dM2qP9xL4s",
    "name": "Reporting",
    "accessLevel": "none",
    "isAllOrganizations": false,
    "permissions": [
      "log:view",
      "workflow:view"
    ],
    "key": "4f8a1c09b6e2d47a83f5c1e09d2b6a74c3e8f01b5a9d27c4e6f30a18b5d92c7e",
    "createdOn": "2026-07-23T14:05:00.000Z"
  }
}
```

## Errors

- 403 Beyond the calling key (API_KEY_PERMISSION_EXCEEDS_ACTOR, API_KEY_PERMISSION_DENIED): `FORBIDDEN` / `API_KEY_PERMISSION_EXCEEDS_ACTOR` "An API key cannot be given permissions beyond your own: member:delete."
