> ## Documentation Index
> Fetch the complete documentation index at: https://komga-sdk.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Import books

> Required role: **ADMIN**



## OpenAPI

````yaml https://raw.githubusercontent.com/gotson/komga/1.25.0/komga/docs/openapi.json post /api/v1/books/import
openapi: 3.1.0
info:
  description: >-
    Komga REST API.


    ## Reference


    Check the API reference:

    - on the [Komga website](https://komga.org/docs/openapi/komga-api)

    - on any running Komga instance at `/swagger-ui.html`

    - on
    [GitHub](https://raw.githubusercontent.com/gotson/komga/refs/heads/master/komga/docs/openapi.json)


    ## Authentication


    Most endpoints require authentication. Authentication is done using either:

    - Basic Authentication

    - Passing an API Key in the `X-API-Key` header


    ## Sessions


    Upon successful authentication, a session is created, and can be reused.


    - By default, a `KOMGA-SESSION` cookie is set via `Set-Cookie` response
    header. This works well for browsers and clients that can handle cookies.

    - If you specify a header `X-Auth-Token` during authentication, the session
    ID will be returned via this same header. You can then pass that header
    again for subsequent requests to reuse the session.


    If you need to set the session cookie later on, you can call
    `/api/v1/login/set-cookie` with `X-Auth-Token`. The response will contain
    the `Set-Cookie` header.


    ## Remember Me


    During authentication, if a request parameter `remember-me` is passed and
    set to `true`, the server will also return a `komga-remember-me` cookie.
    This cookie will be used to login automatically even if the session has
    expired.


    ## Logout


    You can explicitly logout an existing session by calling `/api/logout`. This
    would return a `204`.


    ## Deprecation


    API endpoints marked as deprecated will be removed in the next major
    version.
  license:
    name: MIT
    url: https://github.com/gotson/komga/blob/master/LICENSE
  title: Komga API
  version: 1.25.0
servers:
  - url: https://demo.komga.org
    description: Demo server
  - url: http://localhost:{port}
    description: Local development server
    variables:
      port:
        enum:
          - '8080'
          - '25600'
        default: '25600'
security:
  - basicAuth: []
  - apiKey: []
tags:
  - name: Deprecated
  - description: Manage libraries.
    name: Libraries
  - description: Manage series.
    name: Series
  - description: Manage posters for series.
    name: Series Poster
  - description: Manage books.
    name: Books
  - description: Manage posters for books.
    name: Book Poster
  - name: Book Pages
  - name: WebPub Manifest
  - name: Import
  - description: Provide font files and CSS for the Epub Reader.
    name: Fonts
  - description: Manage duplicate pages. Duplicate pages are identified by a page hash.
    name: Duplicate Pages
  - description: Manage collections.
    name: Collections
  - description: Manage posters for collections.
    name: Collection Poster
  - name: Collection Series
  - description: Manage readlists.
    name: Readlists
  - description: Manage posters for readlists.
    name: Readlist Poster
  - name: Readlist Books
  - description: Retrieve referential metadata from all items in the Komga server.
    name: Referential metadata
  - description: Manage current user.
    name: Current user
  - description: Manage users.
    name: Users
  - description: Manage API Keys
    name: API Keys
  - name: User session
  - description: List registered OAuth2 providers
    name: OAuth2
  - description: Sync points are automatically created during a Kobo sync.
    name: Sync points
  - description: Claim a freshly installed Komga server.
    name: Claim
  - description: Manage server tasks
    name: Tasks
  - description: Server events history
    name: History
  - description: List files from the host server's file system
    name: File system
  - description: Store and retrieve server settings
    name: Server settings
  - description: Retrieve releases information
    name: Releases
  - description: Retrieve announcements from the Komga website
    name: Announcements
  - description: Manage server
    name: Management
  - name: Mihon
  - name: ComicRack
  - description: >-
      Store and retrieve global and per-user settings. Those settings are not
      used by Komga itself, but can be stored for convenience by client
      applications.
    name: Client settings
externalDocs:
  description: Komga documentation
  url: https://komga.org
paths:
  /api/v1/books/import:
    post:
      tags:
        - Import
      summary: Import books
      description: 'Required role: **ADMIN**'
      operationId: importBooks
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BookImportBatchDto'
        required: true
      responses:
        '202':
          description: Accepted
        '400':
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
          description: Bad Request
components:
  schemas:
    BookImportBatchDto:
      type: object
      properties:
        books:
          type: array
          items:
            $ref: '#/components/schemas/BookImportDto'
        copyMode:
          type: string
          enum:
            - MOVE
            - COPY
            - HARDLINK
      required:
        - books
        - copyMode
    ValidationErrorResponse:
      type: object
      properties:
        violations:
          type: array
          items:
            $ref: '#/components/schemas/Violation'
      required:
        - violations
    BookImportDto:
      type: object
      properties:
        destinationName:
          type: string
        seriesId:
          type: string
        sourceFile:
          type: string
        upgradeBookId:
          type: string
      required:
        - seriesId
        - sourceFile
    Violation:
      type: object
      properties:
        fieldName:
          type: string
        message:
          type: string
  securitySchemes:
    basicAuth:
      scheme: basic
      type: http
    apiKey:
      in: header
      name: X-API-Key
      type: apiKey

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.