Create an authorization link
const url = 'https://api.clearance.rest/emails/auth-links';const options = { method: 'POST', headers: {'X-API-Key': '<X-API-Key>', 'Content-Type': 'application/json'}, body: '{"expires_in":604800,"max_uses":1,"providers":["gmail"],"locale":"en","return_url":"example","metadata":{"additionalProperty":"example"},"branding":{"name":"example","logo_url":"example","description":"example","primary_color":"example"}}'};
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.clearance.rest/emails/auth-links \ --header 'Content-Type: application/json' \ --header 'X-API-Key: <X-API-Key>' \ --data '{ "expires_in": 604800, "max_uses": 1, "providers": [ "gmail" ], "locale": "en", "return_url": "example", "metadata": { "additionalProperty": "example" }, "branding": { "name": "example", "logo_url": "example", "description": "example", "primary_color": "example" } }'A public, expiring link that lets anyone connect a Gmail or Outlook mailbox to the project without an account. Share url. metadata is written to the metadata of every connected mailbox and delivered in the email_account.connected event. Free of charge.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Settings of a new authorization link.
object
Lifetime in seconds (default 7 days, min 1 hour, max 30 days).
How many mailboxes can be connected with the link; 0 = unlimited.
Providers offered on the link page (default: gmail and outlook).
Language of the link page.
Where the link page sends the user afterwards; its origin must be in the project’s allowed return origins.
Written to the metadata of every mailbox connected with the link.
object
Overrides the project’s branding field by field.
object
Responses
Section titled “Responses”Default Response
object
The page to share, e.g. https://links.clearance.rest/
UTC timestamp (ISO 8601).
Branding of the link page (project defaults overridden by the link); null fields use the default look.
object
Free-form JSON object (at most 16 KB, 5 levels deep, keys up to 64 characters).
object
UTC timestamp (ISO 8601).
Example
{ "success": true, "status": "active", "providers": [ "gmail" ], "locale": "en"}Default Response
Error envelope returned by every JSON endpoint.
object
object
Machine-readable error code (snake_case).
Human-readable message.
Extra context for the error.
object
Example
{ "success": false}Default Response
Error envelope returned by every JSON endpoint.
object
object
Machine-readable error code (snake_case).
Human-readable message.
Extra context for the error.
object
Example
{ "success": false}Default Response
Error envelope returned by every JSON endpoint.
object
object
Machine-readable error code (snake_case).
Human-readable message.
Extra context for the error.
object
Example
{ "success": false}