Link profiles to companies
- Path
/roles- Auth
- Secret key · server only
const url = 'https://releva.ai/api/v0/roles';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"roles":[{"companyId":"DEMO-CO-1001","role":"buyer","profile":{"email":"maria@example.com"}}]}'};
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://releva.ai/api/v0/roles \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "roles": [ { "companyId": "DEMO-CO-1001", "role": "buyer", "profile": { "email": "maria@example.com" } } ] }'Creates or updates roles. A role links one profile (found by email or phone number) to one company, with
an optional role name. If no profile matches, a new profile is created. A profile has at most one role per
company; sending a new role name replaces the old one. The company is not checked for existence.
Phone numbers are not normalised here: use + and the international code.
Asynchronous.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
object
Free-text role name, for example buyer. Stored as an empty string when omitted.
At least one of email and phoneNumber is required.
object
Example
{ "roles": [ { "companyId": "DEMO-CO-1001", "role": "buyer", "profile": { "email": "maria@example.com" } } ]}Responses
Section titled “Responses”Accepted for asynchronous processing.
object
Example
{}Authentication or validation error. When a profile has neither email nor phoneNumber the body is
plain text (text/html), not JSON.
object
Human-readable error. Several validation errors are joined with a space.
Examples
{ "message": "Authorization header is missing."}{ "message": "roles[0].profile.phoneNumber must be a valid telephone number starting with + and international code, e.g. +1. Got 0888123456 instead."}{ "message": "The object 'roles[0].profile' contains forbidden keys: 'firstName'. The object 'roles[0]' contains forbidden keys: 'title'."}{ "message": "The 'roles[0].profile' field is required."}{ "message": "The 'roles' field must contain at least 1 items."}{ "message": "The 'roles' field is required."}Example
At least one of (email, phoneNumber) is required for each role!The domain is disabled.
object
Human-readable error. Several validation errors are joined with a space.
Example
{ "message": "Domain is disabled. Please reach out to support@releva.ai to enable it."}Request body larger than 800 KB.
object
Human-readable error. Several validation errors are joined with a space.
Example
{ "message": "request entity too large"}Unexpected server error.
object
Human-readable error. Several validation errors are joined with a space.
Example
{ "message": "An internal error occurred."}