---
title: "Upload Image to Book"
method: POST
path: "/v1/book/upload/image"
tags: ["File Uploads"]
---

# Upload Image to Book

`POST /v1/book/upload/image`

## Request

- Base URL: `https://api.ocrolus.com`
- URL: `https://api.ocrolus.com/v1/book/upload/image`
- Auth: OAuth 2
  - Client credentials
  - Token URL: `https://auth.ocrolus.com/oauth/token`

Upload image files to a <<glossary:Book>>.

--- 

You can upload a file to this endpoint as a `multipart/form-data` encoded payload. To learn more, see [multipart/form-data](https://docs.ocrolus.com/reference/multipartform-data-payloads) guide.

With the capability to classify images, you can upload a single image using this endpoint. To upload multiple images to the same <<glossary:Book>>, call this endpoint once for each image, and then call the [Finalize image group](ref:mark-image-group-complete) endpoint to complete the <<glossary:Image group>>. 

We support uploads of the images in the **JPEG**, **PNG**, **BMP**, and **TIFF** (Single-image files only) formats.

## Request body `multipart/form-data`

- object
  - `upload` string, binary, required: The image file that you want to upload. The maximum file size is 200 MB.
  - `book_uuid` string: Universally unique identifier (uuid) of the <<glossary:Book>> to which the uploaded images will be saved to. Mutually exlusive with `pk`.
  - `pk` integer: Unique primary key (<<glossary:PK>>) of the <<glossary:Book>> to which the uploaded images will be saved to. Mutually exlusive with `book_uuid`.
  - `return_image_pk` boolean: Indicates if the response will include the PK of the uploaded image.

## Response `200`

200

- union
  - object
    - `status` integer: A numerical code that indicates the status of the request.
    - `response` object: An object received from the server that potentially contains data.
      - `image_group_pk` integer: Unique primary key (PK) of the <<glossary:image group>>.
      - `image_pk` integer, nullable: Present only when `return_image_pk` is `true` in the request. This is a primary key of the uploaded image. `null` if the upload failed and no image was created.
    - `message` string: A textual description that indicates details about this response's status.
  - object
    - `status` integer: A numerical code that indicates the status of the request.
    - `response` object: An object received from the server that potentially contains data.
      - `status` integer: A numerical code that indicates the status of the request.
      - `message` string: A textual description that indicates details about this response's status.
      - `original_existing_groups_and_image_pks` object[]: An array of details associated with the image group.
        - `existing_image_group_pk` integer: Unique primary key (PK) of the existing <<glossary:image group>>.
        - `existing_image_pk` integer: Primary key of the existing image that matches the uploaded file's checksum.
        - `existing_image_uuid` string: Universally unique identifier (UUID) of the existing image that matches the uploaded file's checksum.
    - `message` string: A textual description that indicates details about this response's status.
  - object
    - `status` integer: A numerical code that indicates the status of the request.
    - `response` object: An object received from the server that potentially contains data.
      - `status` integer: A numerical code that indicates the status of the request.
      - `message` string: A textual description that indicates details about this response's status.
      - `original_existing_groups_and_image_pks` object[]: An array of details associated with the image group.
        - `existing_image_group_pk` integer: Unique primary key (PK) of the existing <<glossary:image group>>.
        - `existing_image_pk` integer: Primary key of the existing image that matches the uploaded file's checksum.
        - `existing_image_uuid` string: Universally unique identifier (UUID) of the existing image that matches the uploaded file's checksum.
    - `message` string: A textual description that indicates details about this response's status.

## Other responses

- `400`: Client Errors
- `500`: Internal server error

---

[API](https://skmtc.dev/ocrolus/apis/file-uploads.md) - [All operations](https://skmtc.dev/ocrolus/apis/file-uploads/llms.txt) - [OpenAPI document](https://skmtc.dev/ocrolus/apis/file-uploads/revisions/f5da69c79aff?raw)
