GRANSKA

Delete a legal source

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

Removes a legal source this organisation owns, and frees its place under the organisation's limit. Answers 204 with no body.

Bearer tokenSpends no quotaAnswers with the rate-limit headers

What it removes

The source itself. After this it is gone from GET /v1/snippets and from the count GET /v1/quotas reports under snippets, so it frees one place under your organisation's limit. A successful delete answers 204 with no body.

This is the counterpart of POST /v1/snippets. Without it, an organisation that reached its limit had no way back down except asking us.

The id in the path is the document id, the id that GET /v1/snippets publishes and that POST /v1/snippets answered with. It is not the snippetKey.

Request
curl -X DELETE https://api.granska.cloud/v1/snippets/tenant_9f3a_snippet_12_ordningsregler_k4m2 \
  -H "Authorization: Bearer $TOKEN"
Response
HTTP/1.1 204 No Content

What you may delete

Sources your own organisation owns, and those only.

A source your organisation inherits, one of ours or the shared catalogue's, answers 403. So does a source another organisation owns, with the same sentence: the answer does not say whose it is.

An id no source is stored at answers 404, and nothing is removed.

Removing twice is not an error you have to avoid

404 is also the answer to deleting a source that is already gone, so "deleted" and "never existed" are one answer. If a response goes missing on the way back to you, send the request again: the second call cannot undo the first.

A source a reviewer still cites stays

A reviewer cites a source by its snippetKey in workers[].snippetIds. Deleting a source a reviewer still cites would leave that reviewer citing nothing, and its next analysis would quietly run without the source. So that delete is refused with 409 and the code SNIPPET_IN_USE.

  • details.workers names the reviewers in your organisation that cite it. Take the source out of their snippetIds with PATCH /v1/profiles/:id, then delete it.
  • details.citedOutsideOrganisation is true when reviewers your organisation does not own cite it too. Those are counted and never named, because their names are not yours to read.
{
  "error": {
    "code": "SNIPPET_IN_USE",
    "message": "This legal source cannot be deleted while a granskare cites it. ...",
    "details": {
      "refusal": "snippet-in-use",
      "workers": ["Ordningsgranskare"],
      "citedOutsideOrganisation": false
    }
  }
}

Your own version of one of our sources

A source your organisation created under the same snippetKey as one of ours is your own version of it: your reviewers, and ours running for you, read yours instead of ours. Deleting it is not refused for those citations. Every reviewer citing that key goes back to reading our source, from the next analysis on.

Request

ParameterDescription
id
string·path·required
The source to remove, as the id GET /v1/snippets published — not its snippetKey. Must be one this organisation owns.

Errors

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 source is not this organisation's: one it only inherits from the platform, or one another organisation owns. Both answer the same sentence. The credential belonging to the platform's own workspace is a 403 too: its shared catalogue is not written through this API. Not probed: each needs a source owned by somebody else, or a platform credential.
404
NOT_FOUND
No source with that id — which is also the answer to removing one that is already gone, so a retry cannot be made to fail. Nothing is removed.
409
SNIPPET_IN_USE
A granskare still cites the source, and removing it would leave that granskare citing nothing. details.workers names the granskare in this organisation, which PATCH /v1/profiles/:id can take it off; granskare it does not own are counted in details.citedOutsideOrganisation and never named. A source that is this organisation's own version of a platform source is not refused for a citation by its snippetKey: that citation falls back to the platform's source. Not probed: it needs a source a granskare cites.
429
TOO_MANY_REQUESTS
The organisation has spent its hourly configuration-write floor. This is an abuse floor and not a plan limit; no analysis quota is consumed. Not probed: reaching it would mean sending sixty writes.
500
INTERNAL_ERROR
An unexpected server-side failure. Not probable from outside — reaching it means something is wrong.

Rate limiting

Deleting a source never spends an analysis from your quota. It ticks the same hourly floor as creating and editing one, a guard against a client in a loop, reported by the X-RateLimit-* headers on this route's answers and by GET /v1/quotas.