Upload a file into a folder library
const url = 'http://localhost:8080/api/v1/libraries/1/files/example';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/octet-stream'}, body: 'binary'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url http://localhost:8080/api/v1/libraries/1/files/example \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/octet-stream' \ --data binaryAdmin only. The request body is the file’s bytes, up to CHEK_MAX_UPLOAD_BYTES (2 GiB by default). The file is checked against its extension, moved into place and recorded like any file the scan finds. If a scan of the library is running, recording waits for it, and after 20 seconds the response is 202 while recording carries on.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Where to store the file, relative to the library’s folder, with / between folders, such as Saga/Saga 01.cbz. Missing folders are created. Every part must be a plain name (no ., .. or names starting with .), and the file must end in .epub, .pdf, .cbz, .cbr, .cb7 or .cbt. A comic may be any comic archive whatever its comic extension says.
Request Bodyrequired
Section titled “Request Bodyrequired”Responses
Section titled “Responses”The file was stored and recorded.
object
object
From the file’s metadata, or its file name when it has none.
The number in its series as the file’s metadata writes it, such as “3”, “1.5” or “Vol. 3”.
Comic archives get their format from their bytes, so a ZIP named
.cbr is cbz. A FictionBook zipped as .fb2.zip or .fbz is
fb2 too; its file downloads as application/x-zip-compressed-fb2.
remote is a chapter from an extension: it has pages but no file.
A chapter from an extension whose source reads only EPUBs or only
PDFs is epub or pdf, and its file is downloaded through the
source.
Number of pages for comic formats.
False when the file is missing from disk. Missing files are kept so progress survives.
Whether /cover has an image for this publication.
Example
{ "format": "epub"}The file was stored and will be recorded once the running scan finishes.
object
Example
{ "status": "queued"}The request was malformed.
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}The request has no valid session token.
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}The signed-in user may not do this. demo_account when the user is a
shared demo account, named in CHEK_DEMO_USERS, which can’t change
its password, sessions, sign-in providers, extensions or annotations.
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}The resource does not exist.
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}A file already exists at that path (file_exists), or the server can’t write to the library’s folder (library_read_only).
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}The file is larger than CHEK_MAX_UPLOAD_BYTES.
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}The file was stored but can’t be read, such as a damaged archive. It stays in the folder like any other unreadable file.
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}The server failed; details are in its log.
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}