프로그래밍 방식으로 인용을 검증. 단일 엔드포인트, SSE 스트리밍.

Base URL

https://api.citetrue.com

빠른 시작

  1. 대시보드 → API 키로 이동, 새 API 키 클릭. sk_로 시작하는 키를 복사. 한 번만 표시됩니다.
  2. 매 요청마다 Authorization: Bearer sk_…에 키를 포함하세요.
  3. /verify/v2로 작업을 POST. 응답은 text/event-stream; task_completed가 보일 때까지 SSE 이벤트를 소비하세요.

최소 호출:

curl -N -X POST https://api.citetrue.com/verify/v2 \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"[1] Vaswani, A., Shazeer, N., Parmar (2017). Attention is all you need."}'

-N는 curl 버퍼링을 끄고 SSE 이벤트를 줄 단위로 스트리밍합니다. depth를 고를 필요가 없습니다 — 모든 참조가 같은 흐름으로 처리됩니다. 대부분 1크레딧이며, 더 많은 데이터 소스와 추가 분석이 필요한 까다로운 참조는 최대 5크레딧입니다.

클라이언트 예제

SSE는 각 이벤트가 빈 줄(\n\n)로 끝나는 장기 HTTP 응답입니다. data: 로 시작하지 않는 줄은 건너뛰고 나머지를 JSON 파싱하세요.

브라우저 주의: 내장 EventSource는 Authorization 헤더를 보낼 수 없습니다 — 아래처럼 fetch + ReadableStream를 사용하세요.

Node 18+ with native fetch.

const API = 'https://api.citetrue.com'
const KEY = process.env.API_KEY

async function verify(text) {
  const resp = await fetch(`${API}/verify/v2`, {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ text }),
  })
  if (!resp.ok) throw new Error(`${resp.status}: ${await resp.text()}`)

  const reader = resp.body.getReader()
  const decoder = new TextDecoder()
  const refs = []
  let buf = ''

  while (true) {
    const { value, done } = await reader.read()
    if (done) break
    buf += decoder.decode(value, { stream: true })
    let idx
    while ((idx = buf.indexOf('\n\n')) !== -1) {
      const chunk = buf.slice(0, idx); buf = buf.slice(idx + 2)
      for (const line of chunk.split('\n')) {
        if (!line.startsWith('data: ')) continue
        const evt = JSON.parse(line.slice(6))
        if (evt.event === 'ref_completed') {
          refs.push(evt.data.ref)
        }
        if (evt.event === 'task_completed') return { refs, balance: evt.data.balance }
        if (evt.event === 'error') throw new Error(evt.error)
      }
    }
  }
}

const out = await verify('[1] Vaswani, A., Shazeer, N., Parmar (2017). Attention is all you need.')
console.log(out)

인증

API 키는 sk_<40-char-token> 형태의 장기 베어러 토큰입니다. Authorization 헤더에 보내세요:

Authorization: Bearer sk_AbCd123…
  • 대시보드에서 키를 철회할 수 있습니다. 수 초 내 적용됩니다.
  • 키는 소유 사용자가 할 수 있는 모든 작업을 수행합니다. 비밀번호처럼 취급 — 통합별로 분리하고 주기적으로 교체하세요.

속도 제한

각 API 키에는 토큰 버킷 리미터가 있습니다:

  • 버스트: 10 요청.
  • 지속: 60 요청/분 (버킷은 1 token/s로 재충전).
  • 초과 시 요청은 429 실패 + Retry-After 헤더(초)를 반환합니다.

리미터는 키 단위입니다; 동일 계정의 다른 키는 독립적인 버킷을 가집니다. 크레딧은 이와 별도로 적용됩니다.

요청 헤더

Every endpoint accepts the same authentication and content-type headers; only the request body and URL differ.

Header필수값
AuthorizationyesBearer sk_…
Content-Typeyesapplication/json

Responses are 200 OK with Content-Type: text/event-stream.

data: {"event":"<name>","data":{...},"error":""}

POST /verify/v2

Split a text blob into references and verify each. Supply exactly one of text (new task) or taskHash (resume). Every reference goes through the same flow — there is no verification level to choose.

요청 본문

필드타입비고
textstringNew verify task. Max 10MB. Accepts numbered, bulleted, blank-line-separated, BibTeX, or in-text prose with (Author, Year) citations.
taskHashstringResume an existing task — replays cached state or attaches to live stream. References already charged aren't charged again; any that still need work are finished and billed as usual.
forceboolBypass the task-level dedup cache (forces a fresh run, billed like a new check).
localestringOptional 2-letter language code ("zh", "ja", "de", …). When set, AI translates the per-ref note into that language and surfaces it under noteTranslated[locale]. Default "" / "en" = no translation.

멱등성: same text + same user returns the cached task on second POST (no re-billing) unless force: true.

Deprecated fields

  • depth — still accepted but ignored (1, 5, 20 or omitted all behave the same). Don't send it.
  • refHash + parentTaskHash — legacy single-reference mode kept for older clients. It ignores depth and simply finishes that one reference, billed under the normal rules. New integrations shouldn't use it.

요청 예시 (text)

{
  "text": "[1] Vaswani, A., Shazeer, N., Parmar (2017). Attention is all you need.\n[2] Piketty, T. (2016). Capital in the twenty-first century. Harvard University Press."
}

요청 예시 (resume)

{
  "taskHash": "f0e1d2c3b4a5..."
}

일반적인 이벤트 시퀀스

task_created → refs_created (N refs) →
  [ref_processing + ref_completed] × N (parallel) +
  task_progress × several →
task_completed

Per-ref assessment

Each ref_completed event carries an assessment string from this closed set:

  • authentic — paper exists and is the one cited. value contains the matched paper.
  • unsure — found something but can't confirm; notices and confidence describe why.
  • inauthentic — definitively not found / fabricated / unrelated.
  • invalid — input wasn't a citation; pipeline refused to search before any datasource hit.
  • error — verification failed on this single ref; sibling refs may still succeed. data.errors[] lists tokens (datasource_unavailable, timeout, rate_limited, parse_failed).
  • exceeded — account ran out of credits before this ref could run.

Notices on a result (year mismatch, author mismatch, …) are orthogonal to assessment — even an authentic verdict can carry notices worth showing. data.cost is the total credits this task has charged for the reference (0–5): 1 for most references, up to 5 for tricky ones that needed more data sources and more analysis, 0 if it was already paid for in another task. It covers every connection and resume of the same task, and the same number is sent on every push, replays included — overwrite it, don't add it up across reconnects. data.depth is kept only for compatibility with older clients — ignore it.

SSE 이벤트

SSE event names emitted during verification. Listen for task_completed as the terminal success event; error for terminal failure.

  • task_created — task accepted, hash assigned.
  • refs_created — text was split into N refs.
  • split_completed — splitting phase finished.
  • ref_processing / ref_status — per-ref progress signal.
  • ref_completed — per-ref final assessment.
  • task_completed — all refs done; carries cost (credits newly charged during this connection, 0 for a pure replay) and the account balance afterwards (can be negative — see Credits & billing).
  • task_progress — periodic progress %.
  • warn — non-fatal warning.
  • error — terminal task-level failure.

GET /credits

GET /credits/v1 — returns current credit balance. Auth required. The balance can be negative (see Credits & billing).

크레딧 & 과금

Most references cost 1 credit. Tricky ones that need more data sources and more analysis can cost up to 5. Each reference is charged 1 credit when it's queued; anything extra is added when it finishes. Cached tasks (same text + user) do not re-bill.

Reading the charge: data.cost in ref_completed is the running total this task has charged for that reference — the same number is sent again on reconnects and replays, so overwrite it rather than adding it up. cost in task_completed is what this connection newly charged (0 for a pure replay), so after a reconnect it won't equal the sum of the per-ref costs. balance is the account balance afterwards.

Running out: a reference that hasn't started when the balance can't cover it comes back as exceeded, and the task still ends with task_completed. If you run out of credits mid-check, references already in progress still finish; the overage is deducted at your next credit reset, so balance can be negative.

오류 레퍼런스

Standard HTTP status codes apply (400 invalid, 401 auth missing/invalid, 402 insufficient credits, 429 rate-limited, 5xx upstream). SSE-level failures arrive as a final error event.

버전 & 안정성

Path-versioned (/verify/v2 etc.). Breaking changes bump the version segment; backwards-compatible additions ship in-place.

CiteTrue 팀이 관리 · 최종 업데이트: