Record the signed-in person's own acceptances
const url = 'https://api.emite.cr/v1/legal/acceptances';const options = { method: 'POST', headers: { 'user-agent': 'example', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"acceptances":[{"documentType":"terminos-y-condiciones","documentVersion":"1.0","documentHash":"sha256:abcdef0123456789...","acceptanceMethod":"signup","orderFormId":"order-form-12345"}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
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.
object
Slug of the document accepted: terminos-y-condiciones (Terms and Conditions), politica-de-privacidad (Privacy Policy) or politica-de-cookies (Cookie Policy).
Example
terminos-y-condicionesThe 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.
Example
1.0The 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.
Example
sha256:abcdef0123456789...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.
Example
signupReference of the signed Order Form, up to 64 characters, when acceptanceMethod is order-form. Stored as given.
Example
order-form-12345Responses
Section titled “Responses”object
Acceptances written now.
Acceptances of a version the person had already accepted: not written again, and not an error.
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).