# Create a selection

Creates a selection using one of the following modes:
- **Mode 1** Direct Entity IDs - use this mode when you know the specific entity IDs to add.
- **Mode 2** Query-Based Selection - use this mode to select entities based on search criteria. The system executes the query and adds matching entities.

Query types are case-insensitive (for example, `BASIC`, `basic`, `Basic`). You can create queries that include various [parameters](https://doc.sitecore.com/ch/en/developers/cloud-dev/parameters.html).
If `values` is provided and non-empty, it takes precedence and `query` is ignored.

Endpoint: POST /api/selection
Version: v1.0
Security: OAuth2.0

## Security:

  - `OAuth2.0` (unknown)
    oauth2

## Request fields (application/json):

  - `values` (array)

  - `type` (string)
    Query type (e.g. "basic")

  - `query` (string)

  - `selectionPool` (string, required)

  - `definitionName` (string)

  - `subPoolId` (integer)

  - `ignorePermissions` (boolean)

## Request examples:

  - `Direct entity IDs` (unknown)

  - `Query-based selection` (unknown)

## Response 201:

  - `201` (unknown)
    Selection created

## Response 201 fields (application/json):

  - `items` (array)

  - `permissions` (array)

  - `link` (object)

  - `link.href` (string)

  - `link.type` (string)

## Response 201 headers (application/json):

  - `Location` (string)
    URI to retrieve the selection

## Response 400:

  - `400` (unknown)
    Invalid request

## Response 403:

  - `403` (unknown)
    Selection capacity exceeded. Default limit is 5000 entities per selection. Validation considers (current items + items to add - items to remove).

## Response 403 fields (application/json):

  - `message` (string)

## Response 404:

  - `404` (unknown)
    Selection pool not found

