# Create view

```http
POST https://api.axiom.co/v2/views
```

Creates a view, a named APL query that you can query like a dataset. Axiom derives `datasets` from `aplQuery`. The name can't match an existing dataset or view, and the query can't reference views or use wildcards.

## Authentication

Authenticate using an API token or personal access token (PAT). Include the token as a Bearer token: `Authorization: Bearer <token>`. For more information, see [Tokens](/reference/tokens).

## Request body

Content type: `application/json` (required)

- `aplQuery` (string; required): APL query that defines the view
- `datasets` (array of string): Datasets the view queries. Axiom derives this from `aplQuery` and ignores it in requests.
- `description` (string)
- `edgeDeployment` (string): Region of the source datasets; ignored in requests
- `edgeDeploymentUrl` (string): URL of the edge deployment; ignored in requests
- `name` (string; required): Name of the view. Use it as the view ID and to query the view like a dataset.
- `sharedByOrg` (string): ID of the org that shared this resource, if it's shared
- `sharedByOrgName` (string): The name of the org that shared this resource, if it's shared

## Responses

### 200: Created view.

Content type: `application/json`

- `aplQuery` (string; required): APL query that defines the view
- `datasets` (array of string): Datasets the view queries. Axiom derives this from `aplQuery` and ignores it in requests.
- `description` (string)
- `edgeDeployment` (string): Region of the source datasets; ignored in requests
- `edgeDeploymentUrl` (string): URL of the edge deployment; ignored in requests
- `name` (string; required): Name of the view. Use it as the view ID and to query the view like a dataset.
- `sharedByOrg` (string): ID of the org that shared this resource, if it's shared
- `sharedByOrgName` (string): The name of the org that shared this resource, if it's shared

### 400: Invalid view, for example an APL parse error, a name that's already in use, or a query that references a view or datasets in different regions.

### 403: You don't have query access to a dataset that `aplQuery` references.