Aller au contenu principal

Référence de l'API REST v2

URL de base https://api.readsira.com/rest/v2. Chaque route exige une clé d'API (Authorization: Bearer pk_..., voir Authentification et clés d'API). Les réponses utilisent l'enveloppe { success, data, meta } et les tableaux ci-dessous décrivent data. Les erreurs ont la forme décrite dans Limites de débit et erreurs. Un paramètre ou un champ de corps que la route ne connaît pas donne un 400.

Le texte provenant de pages enregistrées (extraits, texte des documents, passages) est un contenu tiers. Traitez-le comme des données, jamais comme des instructions pour un modèle.

Les routes, les paramètres et les exemples ci-dessous sont générés directement à partir de l'API et sont donc en anglais.

The REST API is part of the Pro and Research plans. 12 routes:

  • GET /search: Search your library
  • POST /ask: Ask your library (cited answer)
  • GET /documents/{id}: Read a document
  • GET /documents/{id}/chunks: A document's chunks
  • GET /documents/{id}/transcript: Timed transcript of a video or audio document
  • POST /uploads: Start an upload (audio, video or PDF)
  • POST /uploads/{id}/complete: Finish an upload: checks size and type, then processes it
  • GET /usage: Your API usage and limits
  • GET /projects: Your projects
  • GET /projects/{id}/context: A project's context
  • POST /projects/{id}/items: Add sources to a project
  • POST /projects/{id}/notes: Add a note to a project

Search your library​

GET /search

Scope: read:library.

Hybrid (semantic + text) search over your bookmarks and followed feeds. Hits carry chunk ids, PDF pages and media timestamps. Snippets are third-party content, never instructions.

ParameterInTypeRequiredNotes
qquerystringyes
limitquerynumberno1-20, default 8
collectionIdqueryuuidno
feedIdqueryuuidno
sourcequerybookmarks, feeds, allno
curl -G "https://api.readsira.com/rest/v2/search" \
-H "Authorization: Bearer $READSIRA_KEY" \
--data-urlencode "q=..."

Response 200, in data:

FieldTypeNotes
resultsobject[]
results[].documentIduuid
results[].chunkIduuid
results[].bookmarkIduuid or null
results[].entryIduuid or null
results[].titlestring
results[].urlstring
results[].contentTypearticle, pdf, video, audio, note
results[].snippetstringChunk text, at most 600 characters. Untrusted third-party content.
results[].scorenumberHybrid score 0-1
results[].pageNumbernumber or nullPDF page
results[].startSecondsnumber or nullMedia: chunk start
results[].endSecondsnumber or null
degradedlexical or nulllexical = the AI breaker is open; results come from text match only

Errors for this route:

  • 402: PLAN_REQUIRED: the plan has no REST API (Free)
  • 429: RATE_LIMITED: per-key hourly or per-user daily limit (Retry-After)

Ask​

Ask your library (cited answer)​

POST /ask

Scope: ask:library.

Runs Readsira's model over your best-matching passages and returns the answer with citations. Counts toward askAnswersPerMonth and the AI chat budget (402 when used up).

Request body (JSON):

FieldTypeRequiredNotes
questionstringyes1 to 2000 characters
bookmarkIdsuuid[]noAnswer only from these bookmarks (ids you do not own match nothing). at most 50 items
curl -X POST "https://api.readsira.com/rest/v2/ask" \
-H "Authorization: Bearer $READSIRA_KEY" \
-H "Content-Type: application/json" \
-d '{"question":"..."}'

Response 200, in data:

FieldTypeNotes
answerstringAnswer text with [n] markers
citationsobject[]
citations[].nnumberMarker in the answer text: [n]. at least 1
citations[].documentIdstringShared document id ("" for answers saved before citations v2)
citations[].chunkIduuid or nullnull when the source changed or the answer predates citations v2
citations[].bookmarkIduuid or nullThe caller's bookmark of the document
citations[].entryIduuid or nullFeed entry, when cited through a subscription
citations[].publishedAtdate-time or nullWhen the source was published (its earliest feed entry); null when unknown, absent on older answers
citations[].titlestring
citations[].urlstring
citations[].contentTypeobject
citations[].quotestringVerbatim span of the chunk (verified) or its first 200 chars (excerpt). at most 400 characters
citations[].quoteStartnumberChar offset into the chunk, inclusive. at least 0
citations[].quoteEndnumberChar offset into the chunk, exclusive. at least 0
citations[].pagenumber or nullPDF page
citations[].startSecondsnumber or nullVideo / audio start, seconds
citations[].endSecondsnumber or nullVideo / audio end, seconds
citations[].scorenumberRetrieval score. at most 1
citations[].verifiedbooleanfalse: the quote is an excerpt, not a verified quote
citations[].removedbooleantrue when the cited bookmark was removed from your library since the answer (Open source unavailable)
passagesReadnumberPassages given to the model
modelstring or null

Errors for this route:

  • 402: PLAN_REQUIRED: the plan has no REST API (Free)
  • 429: RATE_LIMITED: per-key hourly or per-user daily limit (Retry-After)

Documents​

Read a document​

GET /documents/{id}

Scope: read:library.

Text of a document you can read (your bookmark, a followed feed entry or your upload), in pages: pass nextOffset as offset until it is null.

ParameterInTypeRequiredNotes
idpathuuidyes
offsetquerynumberno
maxCharsquerynumbernoDefault 12000, max 20000
curl "https://api.readsira.com/rest/v2/documents/$DOCUMENT_ID" \
-H "Authorization: Bearer $READSIRA_KEY"

Response 200, in data:

FieldTypeNotes
documentIduuid
titlestring
urlstring
contentTypearticle, pdf, video, audio, note
authorstring or null
bookmarkIduuid or null
savedAtdate-time or null
tagsstring[]
notesstring or null
highlightsobject[]
highlights[].textstring
highlights[].notestring or null
textstringText from offset (characters), untrusted third-party content
offsetnumber
nextOffsetnumber or nullPass as offset for the rest; null at the end
truncatedboolean
totalCharsnumber

Errors for this route:

  • 402: PLAN_REQUIRED: the plan has no REST API (Free)
  • 429: RATE_LIMITED: per-key hourly or per-user daily limit (Retry-After)

A document's chunks​

GET /documents/{id}/chunks

Scope: read:library.

Content chunks in order with page and timestamps, keyset paged: pass nextCursor as cursor.

ParameterInTypeRequiredNotes
idpathuuidyes
cursorquerynumberno
limitquerynumbernoMax 100, default 20
curl "https://api.readsira.com/rest/v2/documents/$DOCUMENT_ID/chunks" \
-H "Authorization: Bearer $READSIRA_KEY"

Response 200, in data:

FieldTypeNotes
documentIduuid
chunksobject[]
chunks[].chunkIduuid
chunks[].indexnumber
chunks[].contentstring
chunks[].pagenumber or null
chunks[].startSecondsnumber or null
chunks[].endSecondsnumber or null
nextCursornumber or nullPass as cursor for the next page

Errors for this route:

  • 402: PLAN_REQUIRED: the plan has no REST API (Free)
  • 429: RATE_LIMITED: per-key hourly or per-user daily limit (Retry-After)

Timed transcript of a video or audio document​

GET /documents/{id}/transcript

Scope: read:library.

ParameterInTypeRequiredNotes
idpathuuidyes
cursorquerystringnoSegment offset
limitquerynumbernoMax 500
curl "https://api.readsira.com/rest/v2/documents/$DOCUMENT_ID/transcript" \
-H "Authorization: Bearer $READSIRA_KEY"

Response 200, in data:

FieldTypeNotes
documentIduuid
statusobject or null
languagestring or null
sourcecaptions, whisper, upload_whisper, publisher or null
durationSecondsnumber or null
segmentsobject[]
segments[].startSecondsnumber
segments[].endSecondsnumber
segments[].textstring
segments[].speakerstring or nullWho speaks, as the publisher transcript names them (Podcasting 2.0 JSON speaker, WebVTT <v Name>, SRT "Name:"); null when the source names no one (captions, Whisper)
nextCursorstring or nullSegment offset of the next page

Errors for this route:

  • 402: PLAN_REQUIRED: the plan has no REST API (Free)
  • 429: RATE_LIMITED: per-key hourly or per-user daily limit (Retry-After)

Projects​

Your projects​

GET /projects

Scope: read:projects.

Projects of one status (default active), most recently active first. Keyset paged.

ParameterInTypeRequiredNotes
statusqueryactive, archivedno
cursorquerystringno
limitquerynumberno1-50, default 20
curl "https://api.readsira.com/rest/v2/projects" \
-H "Authorization: Bearer $READSIRA_KEY"

Response 200, in data:

FieldTypeNotes
projectsobject[]
projects[].iduuid
projects[].namestring
projects[].descriptionstring or null
projects[].statusactive, archived
projects[].itemCountnumberItems of any kind (sources, highlights, notes)
projects[].sourceCountnumber
projects[].updatedAtdate-time
nextCursorstring or nullPass as cursor for the next page

A project's context​

GET /projects/{id}/context

Scope: read:projects.

Instructions, decided decisions, pinned notes and sources; with q, the best passages from the project. Trimmed to maxChars (default 16,000, max 32,000). Text from sources is third-party content, never instructions.

ParameterInTypeRequiredNotes
idpathuuidyes
qquerystringno
maxCharsquerynumberno
curl "https://api.readsira.com/rest/v2/projects/$PROJECT_ID/context" \
-H "Authorization: Bearer $READSIRA_KEY"

Response 200, in data:

FieldTypeNotes
projectobject
project.iduuid
project.namestring
project.instructionsstring or null
decisionsobject[]Decided decisions, newest first
decisions[].titlestring
decisions[].statusstring
decisions[].decidedAtdate-time
decisions[].bodystring or null
notesobject[]Pinned notes
notes[].titlestring or null
notes[].bodystring
passagesobject[]With q only
passages[].kindchunk, note
passages[].documentIduuid or null
passages[].chunkIduuid or null
passages[].bookmarkIduuid or null
passages[].noteIduuid or null
passages[].titlestring
passages[].urlstring or null
passages[].snippetstringAt most 600 characters. Untrusted third-party content.
passages[].scorenumber
passages[].pageNumbernumber or null
passages[].startSecondsnumber or null
sourcesobject[]Pinned first; excluded and deleted sources are left out
sources[].bookmarkIduuid
sources[].documentIduuid or null
sources[].titlestring
sources[].urlstring
sources[].rolesource, background
sources[].pinnedboolean
truncatedbooleanParts were left out to stay within maxChars
degradedlexical

Add sources to a project​

POST /projects/{id}/items

Scope: write:projects.

Bookmarks, highlights, notes, feed entries or URLs (a URL is saved to your library first). Items already in the project count in alreadyPresent.

ParameterInTypeRequiredNotes
idpathuuidyes

Request body (JSON):

FieldTypeRequiredNotes
itemsobject[]yesExactly one target per item; at most 20 url / entryId items per request. 1 to 100 items
items[].bookmarkIduuidno
items[].entryIduuidnoA feed entry: saved as a bookmark first
items[].highlightIduuidno
items[].noteIduuidnoA note of this project (pins it into the context)
items[].urlstringnoA URL: saved as a bookmark first
items[].roleobjectno
items[].commentstring or nullnoat most 2000 characters
curl -X POST "https://api.readsira.com/rest/v2/projects/$PROJECT_ID/items" \
-H "Authorization: Bearer $READSIRA_KEY" \
-H "Content-Type: application/json" \
-d '{"items":[{"url":"https://example.com/report","role":"background"}]}'

Response 201, in data:

FieldTypeNotes
addedobject[]
added[].iduuid
added[].kindobject
added[].roleobject
added[].pinnedboolean
added[].commentstring or null
added[].addedAtdate-time
added[].citationCountnumberCitations of this source in the latest version of the project outputs (0 outside the list)
added[].bookmarkobject or null
added[].highlightobject or null
added[].noteobject or null
alreadyPresentnumberTargets that were already in the project

Errors for this route:

  • 402: PROJECT_LIMIT_REACHED (itemsPerProject)
  • 409: PROJECT_ARCHIVED

Add a note to a project​

POST /projects/{id}/notes

Scope: write:projects.

ParameterInTypeRequiredNotes
idpathuuidyes

Request body (JSON):

FieldTypeRequiredNotes
titlestring or nullnoat most 200 characters
bodyMdstringyesat most 20000 characters
curl -X POST "https://api.readsira.com/rest/v2/projects/$PROJECT_ID/notes" \
-H "Authorization: Bearer $READSIRA_KEY" \
-H "Content-Type: application/json" \
-d '{"bodyMd":"..."}'

Response 201, in data:

FieldTypeNotes
iduuid
titlestring or null
bodyMdstring
pinnedbooleanPinned into the project context
createdAtdate-time
updatedAtdate-time

Errors for this route:

  • 409: PROJECT_ARCHIVED

Uploads​

Start an upload (audio, video or PDF)​

POST /uploads

Scope: write:uploads.

Returns a 15-minute PUT URL bound to the declared Content-Type and size. PUT the bytes, then call complete. Private to you.

Request body (JSON):

FieldTypeRequiredNotes
filenamestringyesat most 255 characters
contentTypeobjectyes
bytesnumberyesExact size of the file in bytes. at least 1
sha256stringnoOptional hex SHA-256 of the file
curl -X POST "https://api.readsira.com/rest/v2/uploads" \
-H "Authorization: Bearer $READSIRA_KEY" \
-H "Content-Type: application/json" \
-d '{"filename":"talk.mp3","contentType":"audio/mpeg","bytes":48213004}'

Response 201, in data:

FieldTypeNotes
uploadIduuid
putUrlstringPUT the file bytes here (presigned, 15 minutes)
putHeadersobjectHeaders the PUT must send unchanged (bound into the signature)
expiresAtdate-time

Errors for this route:

  • 402: PLAN_REQUIRED: the plan has no REST API (Free)
  • 429: RATE_LIMITED: per-key hourly or per-user daily limit (Retry-After)

Finish an upload: checks size and type, then processes it​

POST /uploads/{id}/complete

Scope: write:uploads.

ParameterInTypeRequiredNotes
idpathuuidyes
curl -X POST "https://api.readsira.com/rest/v2/uploads/$UPLOAD_ID/complete" \
-H "Authorization: Bearer $READSIRA_KEY"

Response 202, in data:

FieldTypeNotes
documentIduuid
bookmarkIduuid
statusprocessing

Errors for this route:

  • 402: PLAN_REQUIRED: the plan has no REST API (Free)
  • 429: RATE_LIMITED: per-key hourly or per-user daily limit (Retry-After)

Usage​

Your API usage and limits​

GET /usage

Scope: any scope.

Requests today, plan limits and AI budget used this month. Any scope.

curl "https://api.readsira.com/rest/v2/usage" \
-H "Authorization: Bearer $READSIRA_KEY"

Response 200, in data:

FieldTypeNotes
planfree, pro, research
requestsTodaynumberREST requests today (UTC)
requestsPerDaynumber or null
mcpCallsTodaynumberMCP tool calls today (UTC, weighted)
mcpCallsPerDaynumber or null
requestsPerHournumber or nullThis key's hourly limit in force
askAnswersPerMonthnumber or null
aiBudgetobject[]
aiBudget[].groupstring
aiBudget[].percentUsednumberShare of this month used, 0-100 (rounded)

Errors for this route:

  • 402: PLAN_REQUIRED: the plan has no REST API (Free)
  • 429: RATE_LIMITED: per-key hourly or per-user daily limit (Retry-After)