Accept the pending documents on behalf of the company, through the link.
const url = 'https://api.emite.cr/v1/legal/acceptance-links/accept';const options = { method: 'POST', headers: {'user-agent': 'example', 'Content-Type': 'application/json'}, body: '{"token":"example","acceptances":[{"documentType":"terminos-y-condiciones","documentVersion":"3.0","documentHash":"sha256:abcdef0123456789..."}],"authority":true,"capacity":"holder"}'};
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/acceptance-links/accept \ --header 'Content-Type: application/json' \ --header 'user-agent: example' \ --data '{ "token": "example", "acceptances": [ { "documentType": "terminos-y-condiciones", "documentVersion": "3.0", "documentHash": "sha256:abcdef0123456789..." } ], "authority": true, "capacity": "holder" }'Single use. The person declares the authority to bind the company (authority: true, else 400 LEGAL_AUTHORITY_REQUIRED), and must still be its owner or an admin (403 LEGAL_LINK_NOT_AUTHORIZED). Every pending document must be included, in its served version (400 LEGAL_ACCEPTANCE_INCOMPLETE). 409 LEGAL_LINK_ALREADY_USED the second time.
Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
The token of the acceptance link (/accept-legal?token=).
At most 10 entries, and every document pending for the company must be among them, each in its served version with the hash of its text (400 LEGAL_ACCEPTANCE_INCOMPLETE when one is missing).
object
Slug of a document the company accepts: terminos-y-condiciones or politica-de-privacidad (the documents marked requiredForSignup). The Cookie Policy (politica-de-cookies) is only announced, never accepted (400 LEGAL_DOCUMENT_NOT_REQUIRED).
Example
terminos-y-condicionesThe version of the document served today (its version), up to 32 characters. Any other version is 409 OUTDATED_VERSION.
Example
3.0The SHA-256 of the exact Markdown text shown: sha256: followed by 64 hex digits, copied verbatim from the hash served with the document. It is the proof of which text was accepted; one that differs from the served text is 409 HASH_MISMATCH.
Example
sha256:abcdef0123456789...The person declares the authority to bind the company. Must be true (400 LEGAL_AUTHORITY_REQUIRED).
In which capacity the person declares it (Terms 1.3 and 3.2): holder (a natural person who is the taxpayer), legal_representative, or authorized by whoever represents the company. Recorded with the acceptance (400 LEGAL_CAPACITY_REQUIRED without it).
Responses
Section titled “Responses”object
When the acceptance was recorded.
The documents and versions accepted through the link.
object
Slug of the document.
The version accepted.
Example
{ "documents": [ { "type": "terminos-y-condiciones" } ]}