GRANSKA

Read one legal source

GEThttps://api.granska.cloud/v1/snippets/:id

Reads one legal source by its document id or its snippetKey, full text included.

Bearer tokenSpends no quota

What it returns

The document id is the id GET /v1/snippets returned. This is the widest view of a source the API offers: the same metadata the list carries, plus two more fields.

  • content — the human-readable body of the source.
  • text — the internal representation the engine compiles into a prompt. Published because the contract has always published it, not because most integrations need it.

normLevel, legalWeight and anchors are no longer returned. normLevel is replaced by authorityType; legalWeight and anchors have no replacement. Removed fields says why.

updatedAt is a raw database timestamp rather than ISO 8601, the same quirk as on GET /v1/jobs/:jobId, and is absent on sources that have not been rewritten since they were imported.

:id may also be a snippetKey, the value a granskare's snippetIds on GET /v1/profiles/:id holds. A document id is matched first; otherwise the key is resolved the way an analysis reads it: your organisation's own copy if it has one, else the platform's. The answer's id is then the document's own id.

Request
curl https://api.granska.cloud/v1/snippets/snip_3f0a \
  -H "Authorization: Bearer $TOKEN"
Response
{
  "snippet": {
    "id": "snip_3f0a",
    "tenantId": "SYSTEM",
    "snippetKey": "lss-7-goda-levnadsvillkor",
    "name": "7 § LSS — goda levnadsvillkor",
    "source": "SFS 1993:387",
    "authorityType": "STATUTE",
    "validFromYear": 1994,
    "validToYear": null,
    "updatedAt": {
      "_seconds": 1781164800,
      "_nanoseconds": 0
    },
    "content": "Personer som anges i 1 § har rätt till insatser i form av särskilt stöd …",
    "text": "<snippet id=\"snip_3f0a\">…</snippet>"
  }
}

Request

ParameterDescription
id
string·path·required
The id GET /v1/snippets returned, or a snippetKey a granskare's snippetIds cites. A document id is matched first.

Errors

404 means neither a source with that id nor a key your organisation can read. 403 means the id is another organisation's source and is not a key you can read.

ErrorWhen
401
UNAUTHORIZED
The Authorization header is missing, is not a readable bearer token, or names no tenant.
401
TOKEN_EXPIRED
The access token was issued by this gateway and has since expired. Not probed: it needs a token older than its own lifetime.
403
FORBIDDEN
The id is another tenant's source and is not a snippetKey this tenant can read. Not probed: it needs a source owned by a second tenant.
404
NOT_FOUND
No source with that id or snippetKey.
500
INTERNAL_ERROR
An unexpected server-side failure. Not probable from outside — reaching it means something is wrong.

Send it without writing a client

If your organisation already has an account, an administrator can read a source from the API tester at /admin/api-tester, which fills the :id segment in for you.