PATCH
/
projects
/
{projectIdOrName}
/
api-keys
/
{apiKey}
Update an API key
curl --request PATCH \
  --url https://api.withampersand.com/v1/projects/{projectIdOrName}/api-keys/{apiKey} \
  --header 'Content-Type: application/json' \
  --header 'X-Api-Key: <api-key>' \
  --data '{
  "updateMask": [
    "active",
    "label"
  ],
  "apiKey": {
    "label": "MailMonkey API Key",
    "active": true,
    "scopes": [
      [
        "full",
        "frontend"
      ]
    ]
  }
}'
{
  "key": "api-key-123",
  "label": "MailMonkey API Key",
  "scopes": [
    [
      "full",
      "frontend"
    ]
  ],
  "projectId": "my-project",
  "active": true
}

Authorizations

X-Api-Key
string
header
required

Path Parameters

projectIdOrName
string
required

The Ampersand project ID or project name.

apiKey
string
required

API key to access Ampersand APIs.

Body

application/json
updateMask
string[]
required

Array of field paths specifying which fields to update. Allowed values include:

  • active
  • label
  • scopes
Example:
["active", "label"]
apiKey
object
required

Response

API key updated

key
string
required

The API key.

Example:

"api-key-123"

label
string
required

A short name for the API key.

Example:

"MailMonkey API Key"

scopes
string[]
required

The scopes for the API key.

projectId
string
required

The project ID.

Example:

"my-project"

active
boolean

Whether the API key is active.

Example:

true