Read one legal source
https://api.granska.cloud/v1/snippets/:idReads one legal source by its document id, full text included.
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 three 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.anchors— which provisions of published law this source interprets, as typed objects.
Two of the fields it returns are deprecated: normLevel and legalWeight. See
Deprecated fields, and read authorityType instead.
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.
curl https://api.granska.cloud/v1/snippets/snip_3f0a \
-H "Authorization: Bearer $TOKEN"{
"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
},
"anchors": [
{
"jurisdiction": "SE",
"work": "1993:387",
"pinpoint": "par_7§"
}
],
"content": "Personer som anges i 1 § har rätt till insatser i form av särskilt stöd …",
"text": "<snippet id=\"snip_3f0a\">…</snippet>",
"normLevel": "Lag",
"legalWeight": "BINDING"
}
}Anchors: a provision in three parts
An anchor used to be a URI string such as sfs:1949-381#kap_6_par_1§, optionally with a date
appended. Those strings are gone. An anchor is now an object with three fields:
jurisdiction— the legal order:"SE","NO"or"EU".work— which instrument. An opaque string:"1949:381"in Sweden,"LOV-2018-06-15-38"in Norway,"32016R0679"in the EU.pinpoint— where in it. Also opaque:"kap_6_par_1§","art_6_par_1".
Treat work and pinpoint as opaque. Never parse them, never pattern-match on them, never split
them on a separator. Their shape is jurisdiction-specific and is not part of the contract; the only
thing you may do with the pair is send it back to
GET /v1/snippets with its jurisdiction, as three separate fields.
A pinpoint is not the citation a lawyer writes. "6 kap. 1 §" is how the provision is printed
and read aloud; "kap_6_par_1§" is how it is addressed. They are different fields on the same
provision, and only the second one resolves. Take a pinpoint from a response — from anchors here,
or from the provisions of a work — and send it back unchanged. Do not build one from a citation.
anchors is optional and absent on a source that interprets no particular provision.
{
"anchors": [
{ "jurisdiction": "SE", "work": "1949:381", "pinpoint": "kap_6_par_1§" }
]
}
Request
| Parameter | Description |
|---|---|
idstring·path·required | The id GET /v1/snippets returned for this source. |
Errors
A source belonging to another organisation answers 403 here, where the list endpoint's key lookup
answers 404. The difference is that a document id is not something a caller can guess its way to,
so there is nothing to protect by conflating the two.
| Error | When |
|---|---|
401UNAUTHORIZED | The Authorization header is missing, is not a readable bearer token, or names no tenant. |
401TOKEN_EXPIRED | The access token was issued by this gateway and has since expired. Not probed: it needs a token older than its own lifetime. |
403FORBIDDEN | The source exists but belongs to another tenant. Not probed: it needs a source owned by a second tenant. |
404NOT_FOUND | No source with that id. |
500INTERNAL_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.