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

# POST /v1/apikeys — Create PIN API Key

> Create a new API key on the Aria Compute PIN service. The full plaintext key is returned only once; store it securely before closing the response.

Generate a new user-scoped API key for authenticating with the PIN API. You can assign a custom name to distinguish keys. The full key value is returned only in this response and cannot be retrieved later.

## Endpoint

**POST** `/v1/apikeys`

Authentication: Bearer API key

## Request body

<ParamField body="name" default="default" type="string">
  Human-readable name for the new key.
</ParamField>

## Response

<ResponseField name="id" type="string">
  Unique key identifier.
</ResponseField>

<ResponseField name="name" type="string">
  Name assigned to the key.
</ResponseField>

<ResponseField name="key" type="string">
  Full plaintext API key. Store it immediately; it will not be shown again.
</ResponseField>

<ResponseField name="created_at" type="string">
  ISO 8601 timestamp when the key was created.
</ResponseField>

## Example

```bash theme={null}
curl -X POST http://localhost:8001/v1/apikeys \
  -H "Authorization: Bearer $ARIA_PIN_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"ci-deploy"}'
```

```json theme={null}
{
  "id": "key_9xYz2AbC3dE4",
  "name": "ci-deploy",
  "key": "ak_live_51HbN9xL5wR8fGqJ3...",
  "created_at": "2025-02-08T11:45:00Z"
}
```

Use the create API key endpoint to generate a new API key for programmatic access. Provide a name to identify the key. The full key value is returned only once and cannot be retrieved again.

## Endpoint

```http theme={null}
POST /v1/apikeys
```

## Authentication

Requires a valid `Authorization: Bearer <jwt-or-api-key>` header.

## Request Body

<ParamField body="name" type="string" required>
  Human-readable name for the new API key.
</ParamField>

## Response

<ResponseField name="id" type="string">
  Unique identifier for the created API key.
</ResponseField>

<ResponseField name="name" type="string">
  The name provided in the request.
</ResponseField>

<ResponseField name="key" type="string">
  The full API key value. This is shown only once; store it securely.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://ariapin.example.com:8001/v1/apikeys \
    -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
    -H "Content-Type: application/json" \
    -d '{"name":"production"}'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "code": 0,
    "data": {
      "id": "key_xyz",
      "name": "production",
      "key": "pin_live_abc123..."
    },
    "message": ""
  }
  ```
</ResponseExample>


## Related topics

- [GET /v1/apikeys: List PIN API Keys](/api-reference/pin/apikeys/list.md)
- [Authenticate with PIN API Keys and Agent Tokens](/api-reference/pin/authentication.md)
- [AGENT API Authentication: Bearer and ApiKey](/api-reference/agent/authentication.md)
- [Create Agent - POST /v1/agents](/api-reference/agent/agents/create.md)
- [Create Training Job with PIN API](/api-reference/pin/jobs/create.md)
