# Returns document which has been created

Creates a resource from the request body. Validation errors return **400**; a successful create returns **201** with the created resource in `data`. S3 storage failures return **500**.

Endpoint: POST /v1/documents
Version: 191.0.3
Security: bearerAuth, oAuthSandbox

## Security:

  - `bearerAuth` (unknown)
    http bearer JWT

  - `oAuthSandbox` (unknown)
    oauth2

## Header parameters:

  - `Organization-ID` (string, required)
    Organization context for the request. Must match the organization authorized by the access token.

## Request body:

  - `application/json` (unknown)
    Document metadata and file content which is base64 format.
For further image processing request, operations implied in file field:
- fromX, fromY, width, height and ratio for cropping image operation.
- width, height and ratio for resize image operation.

## Request fields (application/json):

  - `name` (string, required)

  - `tags` (array)

  - `mimeType` (string, required)
    Enum: "PDF", "JPEG", "PNG", "GIF", "DOC", "DOCX", "PPT", "PPTX", "XLS", "XLSX", "MSG", "HTML"

  - `isInS3` (boolean)
    Example: true

  - `userDefinedDate` (string)
    Example: 2021-09-29

  - `ownerPatient` (object)
    A reference to a linked model. Includes the id, the type, and URL at which the model can be accessed.

  - `ownerPatient.id` (integer, required)
    The unique identifier for the linked model.
    Example: 12345

  - `ownerPerioExam` (object)
    A reference to a linked model. Includes the id, the type, and URL at which the model can be accessed.

  - `ownerPerioExam.id` (integer, required)
    The unique identifier for the linked model.
    Example: 12345

  - `ownerOrganization` (object)
    A reference to a linked model. Includes the id, the type, and URL at which the model can be accessed.

  - `ownerOrganization.id` (integer, required)
    The unique identifier for the linked model.
    Example: 12345

  - `file` (object, required)

  - `file.content` (string, required)
    Example: U29tZSBiYXNlNjQgY29udGVudCBoZXJl

  - `file.fromX` (integer)
    If mimeType in [JPEG, PNG, GIF] then field is required
    Example: 2048

  - `file.fromY` (integer)
    If mimeType in [JPEG, PNG, GIF] then field is required
    Example: 2048

  - `file.width` (integer)
    If mimeType in [JPEG, PNG, GIF] then field is required
    Example: 2048

  - `file.height` (integer)
    If mimeType in [JPEG, PNG, GIF] then field is required
    Example: 2048

  - `file.ratio` (number)
    If mimeType in [JPEG, PNG, GIF] then field is required
    Example: 2048

## Request examples:

  - `default` (unknown)

## Response 201:

  - `201` (unknown)
    Document was created

## Response 201 fields (application/json):

  - `data` (object)
    Example: {}

  - `data.id` (integer)
    Example: 1234

  - `data.name` (string, required)

  - `data.tags` (array)

  - `data.thumbNailId` (string)
    Example: thumbNailId Number

  - `data.mimeType` (string, required)
    Enum: "PDF", "JPEG", "PNG", "GIF", "DOC", "DOCX", "PPT", "PPTX", "XLS", "XLSX", "MSG", "HTML"

  - `data.guidName` (string)
    Example: name

  - `data.ownerType` (string)
    Enum: "Organization", "PerioExam", "Patient"

  - `data.storage` (object)

  - `data.storage.thumbnail` (string)

  - `data.storage.original` (string)

  - `data.storage.resized` (string)

  - `data.storage.cropped` (string)

  - `data.isInS3` (boolean)
    Example: true

  - `data.userDefinedDate` (string)
    Example: 2021-09-29

  - `data.ownerPatient` (object)
    A reference to a linked model. Includes the id, the type, and URL at which the model can be accessed.

  - `data.ownerPatient.id` (integer, required)
    The unique identifier for the linked model.
    Example: 12345

  - `data.ownerPatient.type` (string)
    The type of the linked model. This field is read-only.
    Example: ExampleModelType

  - `data.ownerPatient.url` (string, required)
    The URL at which the linked model can be accessed. This field is read-only.
    Example: https://api.example.com/models/12345

  - `data.ownerPerioExam` (object)
    A reference to a linked model. Includes the id, the type, and URL at which the model can be accessed.

  - `data.ownerPerioExam.id` (integer, required)
    The unique identifier for the linked model.
    Example: 12345

  - `data.ownerPerioExam.type` (string)
    The type of the linked model. This field is read-only.
    Example: ExampleModelType

  - `data.ownerPerioExam.url` (string, required)
    The URL at which the linked model can be accessed. This field is read-only.
    Example: https://api.example.com/models/12345

  - `data.ownerOrganization` (object)
    A reference to a linked model. Includes the id, the type, and URL at which the model can be accessed.

  - `data.ownerOrganization.id` (integer, required)
    The unique identifier for the linked model.
    Example: 12345

  - `data.ownerOrganization.type` (string)
    The type of the linked model. This field is read-only.
    Example: ExampleModelType

  - `data.ownerOrganization.url` (string, required)
    The URL at which the linked model can be accessed. This field is read-only.
    Example: https://api.example.com/models/12345

  - `warnings` (array)

  - `warnings.code` (string)

  - `warnings.title` (string)

  - `warnings.description` (string)

  - `warnings.source` (string)

  - `errors` (array)

## Response 400:

  - `400` (unknown)
    The request was invalid or cannot be processed

## Response 401:

  - `401` (unknown)
    Authentication is required and has failed or has not been provided

## Response 403:

  - `403` (unknown)
    The request is understood, but it has been refused or access is not allowed

## Response 404:

  - `404` (unknown)
    The requested resource is either missing or does not exist

## Response 408:

  - `408` (unknown)
    The server timed out while processing the request

## Response 429:

  - `429` (unknown)
    Rate limit exceeded

## Response 500:

  - `500` (unknown)
    An unexpected error occurred, including S3 storage upload or signed URL generation failures

## Response 201 examples:

  - `default` (unknown)

