# Create Query

Create a new query by providing the necessary details. The query will be stored and can be used for further operations.

Endpoint: POST /api/v1/patient-registry/query
Version: V1
Security: bearer

## Security:

  - `bearer` (unknown)
    http bearer JWT

## Header parameters:

  - `ProjectId` (string, required)

## Request body:

  - `application/json` (unknown)
    The data required to create a new query.

## Request fields (application/json):

  - `subjectId` (string, required)
    The ID of the subject for whom the query is being created.
    Example: 1782b464-ab03-4c03-9810-83d42b86e587

  - `organizationIds` (array)
    A list of organization IDs associated with the query.
    Example: ["2.16.840.1.113883.3.3126.2.3.32103.16"]

## Request examples:

  - `Example Query Creation` (unknown)

## Response 201:

  - `201` (unknown)
    The query was successfully created.

## Response 201 fields (application/json):

  - `id` (string, required)

  - `subjectId` (string, required)

  - `created` (string, required)

  - `fhirStatus` (string, required)
    Enum: "delayed", "initiated", "pending", "inProgress", "completed", "exhausted", "error"

  - `ccdaStatus` (string, required)
    Enum: "delayed", "initiated", "pending", "inProgress", "completed", "exhausted", "error"

  - `userId` (string, required)

  - `externalPatientId` (string, required)

  - `externalQueryId` (string, required)

  - `queryAttempts` (array, required)

## Response 400:

  - `400` (unknown)
    Bad Request. The input data is invalid.

## Response 401:

  - `401` (unknown)
    Unauthorized. The user is not authenticated.

## Response 403:

  - `403` (unknown)
    Forbidden. The user does not have permission to create a query.

## Response 429:

  - `429` (unknown)
    Too Many Requests. The user has exceeded the rate limit.

