Write to a library in bulk

Recipes for specific tasks against the API.

Create or update up to 100 library entries in one request. The batch is all or nothing: if any entry fails, nothing is written.

Use this for imports and bulk edits instead of one request per series.

Access#↑

Use a personal access token, or an OAuth token with library.write for writes and library.read for reads.

Write a batch#↑

Send a JSON array to batch upsert:

curl -X POST "https://api.mangabaka.org/v1/my/library/batch" \
  -H "x-api-key: mb-your-token" \
  -H "Content-Type: application/json" \
  -d '[
    { "series_id": 5, "state": "reading", "progress_chapter": 112 },
    { "series_id": 74695, "rating": 80, "priority": 30 }
  ]'
  • 1 to 100 entries. Only series_id is required.
  • A series not yet in the library is created. If state is left out, it gets the user's default state.
  • A series already in the library is patched. Only the fields you send change.
  • Each series_id may appear once.

The other fields match a single library entry: state, rating, priority, progress_chapter, progress_volume, number_of_rereads, start_date, finish_date, note, read_link and is_private. The reference has their types and ranges.

Query options#↑

  • insert_only=true leaves series already in the library untouched.
  • lists takes up to 20 ids of the user's own lists. Repeat it to send several: ?lists=9&lists=12. Every created or updated entry is added to each list. Existing list membership is kept.

Response#↑

One result per entry, in the order you sent them:

{
	"status": 200,
	"data": [
		{
			"series_id": 5,
			"action": "updated"
		},
		{
			"series_id": 74695,
			"action": "created"
		}
	]
}

action is created, updated, or skipped for a series insert_only left alone.

Errors#↑

Every error rejects the whole batch. Nothing is written.

Status Cause
400 Invalid body or field value, an empty or oversized array, a repeated series_id, an unknown, merged or inactive series (the message lists the ids), or a list id that isn't the user's
409 Another request created an entry for one of the series at the same time. Retry the batch
413 Body over 3 MB

Read many entries#↑

Batch read returns the user's entries for up to 100 series. Repeat series_id for each:

curl -H "x-api-key: mb-your-token" \
  "https://api.mangabaka.org/v1/my/library/batch?series_id=5&series_id=74695"

Series that aren't in the library are left out of the response.

To keep a full local copy of a library, use the changes feed instead.