# updateApiKey

```graphql
mutation UpdateApiKey($input: UpdateApiKeyInput!) {
  updateApiKey(input: $input) {
    apiKey {
      id
      projectId
      userId
      accountId
      name
      keyPrefix
      lastUsedAt
      expiresAt
      createdAt
      updatedAt
      status
      revokedAt
      scopes
      scope
    }
  }
}
```

Change an API key's name or expiry.

## Arguments

| Name              | Type               | Required | Description |
| ----------------- | ------------------ | -------- | ----------- |
| `input`           | UpdateApiKeyInput! | Yes      |             |
| `input.id`        | ID!                | Yes      |             |
| `input.name`      | String             |          |             |
| `input.expiresAt` | String             |          |             |

## Variables

```json
{
  "input": {
    "id": "string"
  }
}
```

## Responses

| Status | Description                                    |
| ------ | ---------------------------------------------- |
| 200    | The UpdateApiKeyPayload! in data.updateApiKey. |

## Call it

```bash
curl -X POST "https://api.veryfront.com/graphql" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "mutation UpdateApiKey($input: UpdateApiKeyInput!) {\n  updateApiKey(input: $input) {\n    apiKey {\n      id\n      projectId\n      userId\n      accountId\n      name\n      keyPrefix\n      lastUsedAt\n      expiresAt\n      createdAt\n      updatedAt\n      status\n      revokedAt\n      scopes\n      scope\n    }\n  }\n}",
  "variables": {
    "input": {
      "id": "string"
    }
  }
}'
```

## Example response

```json
{
  "data": {
    "updateApiKey": {
      "apiKey": {
        "id": "string",
        "projectId": "string",
        "userId": "string",
        "accountId": "string",
        "name": "string",
        "keyPrefix": "string",
        "lastUsedAt": "string",
        "expiresAt": "string",
        "createdAt": "string",
        "updatedAt": "string",
        "status": "string",
        "revokedAt": "string",
        "scopes": [
          "string"
        ],
        "scope": "string"
      }
    }
  }
}
```
