Skip to content

Record the signed-in person's own acceptances

POST
/v1/legal/acceptances
curl --request POST \
--url https://api.emite.cr/v1/legal/acceptances \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'user-agent: example' \
--data '{ "acceptances": [ { "documentType": "terminos-y-condiciones", "documentVersion": "1.0", "documentHash": "sha256:abcdef0123456789...", "acceptanceMethod": "signup", "orderFormId": "order-form-12345" } ] }'

Records, all or none, the person's acceptance of the served version of one or more legal documents, with the IP and browser it came from. Each entry must name the version served today (409 OUTDATED_VERSION) and the hash of its text (409 HASH_MISMATCH); a version the person already accepted is not written again and counts in duplicates. This is the person's own record, for an account that exists without it (a new account is created with its acceptance by POST /v1/auth/signup); a company accepts with POST /v1/legal/company-acceptances. Needs a person's session.

user-agent
required
string
Media typeapplication/json
object
acceptances
required

The person's acceptances, from 1 to 20, recorded all or none in one transaction. A version the person already accepted is not recorded again: it counts as a duplicate.

Array<object>
object
documentType
required

Slug of the document accepted: terminos-y-condiciones (Terms and Conditions), politica-de-privacidad (Privacy Policy) or politica-de-cookies (Cookie Policy).

string
Allowed values: terminos-y-condiciones politica-de-privacidad politica-de-cookies
Example
terminos-y-condiciones
documentVersion
required

The version of the document served today (its version), up to 32 characters. Any other version is 409 OUTDATED_VERSION, and then nothing in the request is recorded.

string
Example
1.0
documentHash
required

The SHA-256 of the exact Markdown text the person saw: sha256: followed by 64 hex digits, copied verbatim from the hash served with the document. A hash that differs from the served text is 409 HASH_MISMATCH.

string
Example
sha256:abcdef0123456789...
acceptanceMethod
required

How the acceptance was obtained, recorded as given: signup — while registering (the default); re-acceptance — accepting a new version; order-form — in a signed Order Form.

string
default: signup
Allowed values: signup re-acceptance order-form
Example
signup
orderFormId

Reference of the signed Order Form, up to 64 characters, when acceptanceMethod is order-form. Stored as given.

string
Example
order-form-12345
Media typeapplication/json
object
recorded
required

Acceptances written now.

number
duplicates
required

Acceptances of a version the person had already accepted: not written again, and not an error.

number
Examplegenerated
{
"recorded": 1,
"duplicates": 1
}

An invalid body; a demo session (LEGAL_ACCEPTANCE_NOT_AVAILABLE_IN_DEMO: a demo is never asked to accept, so it records no consent); or a backoffice account (LEGAL_ACCEPTANCE_NOT_FOR_PLATFORM_ACCOUNTS).

No session, or the caller is not a person (an API key has no user).