Decrypt a payload
Requires the decrypt action on this configuration. The inverse of
encrypt, with the same two modes and the same forwarding behaviour.
Reading data already protected is always served, whatever the license
says.
An envelope is refused unless it was produced in the configuration it is
presented to, independently of the authentication tag, and unless the
caller holds the clearance the record carries. Envelopes in the earlier
qanapi: format are refused as a format error rather than attempted and
failed.
X-Qanapi-Classification has no effect here: a record’s classification
is read from the record.
Authorizations
A machine credential, qk_ followed by its secret. Only a hash of the
secret is stored, so a key is displayed exactly once, when it is created
or rotated. A key reaches only the configurations it is linked to.
It may also be sent as Authorization: Bearer qk_..., which is
recognised by the prefix.
Headers
Comma-separated dot paths to encrypt or decrypt, for example
ssn,user.address.postcode. A path that matches nothing is skipped
unless X-Qanapi-Require-Fields is set.
Required unless whole-body mode is selected with X-Qanapi-Full-Body
or X-Qanapi-Mode. A call that names no fields and asks for no
whole-body mode would encrypt nothing, so it answers 422 rather than
returning the document untouched under a success code.
A numeric segment indexes one element of an array, so items.0.card
reaches exactly that element. A segment that is not a number, applied to
an array, is mapped over every element instead: items.card reaches the
card of each object in items, and each one counts separately towards
X-Qanapi-Action-Count.
Naming an array itself encrypts it whole, as one value, rather than element by element.
"ssn,user.dob,items.card"
Treat the whole body as one payload. Any of true, 1, yes or on
turns it on; anything else, or the header's absence, leaves field mode
in effect.
"true"
Alternative spelling of whole-body mode. Either spelling of the value selects it; any other value leaves field mode in effect.
full_body, full-body Fail the request when a named field path matched nothing, rather than
returning the document unchanged. Off by default, and turned on by any
of true, 1, yes or on.
Worth setting in any caller that would rather hear about a typo than
store plaintext: without it, a mistyped path returns the original body
with a success status, and only X-Qanapi-Action-Count: 0 tells the two
apart. Nothing is changed when the request fails this way.
"true"
Forward the processed payload to this absolute URL and relay the answer
back, with its own status, body and headers. Must be http or https.
Every request header travels except x-qanapi-*, authorization and
the hop-by-hop set. Restricted by an allowlist where the installation
sets one.
"https://payments.internal/charge"
Path Parameters
The configuration's proxy slug. Sixteen random lowercase letters and digits unless one was pinned at creation.
"952zpx6vyig3sdyp"
Body
The body is of type object.
Response
The plaintext, in the shape it was encrypted from. In field mode the document is returned as JSON.
In whole-body mode the original bytes are returned exactly as they were before encryption, but the envelope does not record the content type they were sent under, so one is inferred from the bytes themselves, in this order:
application/jsonwhen the body is valid UTF-8, begins with{or[, and parses as JSON.application/xmlwhen the body is valid UTF-8 and begins with<?xmlor<.application/octet-streamwhen the body is not valid UTF-8, which is the case for every binary payload.text/plain; charset=utf-8otherwise.
The inference is a best effort over content, not a record of what was sent. A caller that needs the original content type preserved must carry it alongside the envelope.
The response is of type object.