> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://contentful.com/developers/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://contentful.com/developers/docs/_mcp/server.

# Create an asset key

POST https://preview.contentful.com/spaces/{space_id}/environments/{environment_id}/asset_keys
Content-Type: application/json

Creates an asset key used to sign embargoed asset URLs for secure delivery. Specify an `expiresAt` Unix timestamp (maximum 48 hours ahead) to control key validity.

Reference: https://contentful.com/developers/docs/references/content-preview-api/asset-keys/create-an-asset-key

## Request

### Path parameters

- `space_id` (string, required) — Alphanumeric id of the space to retrieve.
- `environment_id` (string, required) — ID of the environment in form of a string.

### Query parameters

- `access_token` (string, required) — A *preview* Content Preview API key.

### Body (application/json)

This endpoint expects a map from string to any.

- `map from string to any`

## Response

### 200

OK - Request successful

- `map from string to any`

## Examples

**Request**

```json
{
  "expiresAt": 1613590465
}
```

**Response**

```json
{
  "policy": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjE6MSJ9.eyJleHAiOjE2MTIyODE0MTEsInN1YiI6Inl6MjJwOGZzeGhpNiIsImF1ZCI6ImFkbiIsImp0aSI6ImQ1NWI2YmM1LTkyMGEtNDRjNi1hNmQ0LTM0YzRhYmIyYjdkNiIsImN0Zjp1bnB1YiI6dHJ1ZX0",
  "secret": "-jE6hqytutc_dygbjShVq0PijvDn80SdT0EWD1mNHgc"
}
```

**SDK Code**

```android Android
No snippet for this SDK.
```

```java Java
No snippet for this SDK.
```

```kotlin Kotlin
No snippet for this SDK.
```

```swift Swift
No snippet for this SDK.
```

```javascript JavaScript
No snippet for this SDK.
```

```php PHP
No snippet for this SDK.
```

```ruby Ruby
No snippet for this SDK.
```

```python Python
No snippet for this SDK.
```

```.net .NET
No snippet for this SDK.
```