curl --request POST \
--url https://app.sahlfinancial.com/api/v1/kyb/ma/onboard \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form modele_j=@example-file \
--form cin=@example-file \
--form 'attestation_if=<string>' \
--form 'cin_back=<string>' \
--form 'reference=<string>' \
--form 'environment=<string>'const form = new FormData();
form.append('modele_j', '<string>');
form.append('cin', '<string>');
form.append('attestation_if', '<string>');
form.append('cin_back', '<string>');
form.append('reference', '<string>');
form.append('environment', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://app.sahlfinancial.com/api/v1/kyb/ma/onboard', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.sahlfinancial.com/api/v1/kyb/ma/onboard"
files = {
"modele_j": ("example-file", open("example-file", "rb")),
"cin": ("example-file", open("example-file", "rb"))
}
payload = {
"attestation_if": "<string>",
"cin_back": "<string>",
"reference": "<string>",
"environment": "<string>"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text){
"kyb_id": "9c1d6e22-8b3f-4a57-a0d4-5e2f7b1c3a68",
"environment": "sandbox",
"reference": "company-0001",
"document_kind": "modele_j",
"company": {
"raison_sociale": "SPECIMEN SARL",
"forme_juridique": "SARL",
"ice": "001234567000062",
"rc_number": "123456",
"tribunal": "Casablanca",
"siege_social": "1 Rue de l'Exemple, Casablanca",
"capital": "100000",
"date_creation": "2020-01-15",
"activite": "Conseil",
"gerants": [
{
"nom": "CLIENT",
"prenom": "Test",
"nom_ar": null,
"cin": "BK123456",
"qualite": "Gérant"
}
]
},
"tax": {
"if_number": "12345678"
},
"manager": {
"nom": "CLIENT",
"prenom": "Test",
"nom_ar": null,
"cin_number": "BK123456",
"date_naissance": "1988-04-12",
"expiry": "2030-05-01"
},
"checks": [
{
"key": "documents_read",
"status": "pass",
"message": "All documents were read."
},
{
"key": "ice_format",
"status": "pass",
"message": "ICE has 15 digits."
}
],
"gerant_match": {
"matched": true,
"gerant_index": 0,
"score": 1,
"method": "cin_number",
"reason": null
},
"decision": "auto_ok",
"reasons": [],
"screening": {
"status": "pass",
"matches": []
},
"evidence": {
"company.ice": {
"status": "valid",
"confidence": 0.98,
"evidence": "agreement",
"source": "modele_j",
"corroborated_by": [
"attestation_if"
]
}
},
"documents": [
{
"role": "modele_j",
"sent": true,
"filenames": [
"specimen-modele-j.pdf"
],
"content_types": [
"application/pdf"
],
"read": true,
"reader_unavailable": false,
"fields_read": 11,
"latency_ms": 5200,
"model_calls": 1
}
],
"reader_unavailable": false,
"company_record": "stored",
"billing": {
"documents_billed": 3,
"environment": "sandbox"
},
"latency_ms": 7400
}{
"detail": {
"code": "empty_file",
"message": "modele_j is empty."
}
}{
"detail": "Invalid or revoked API key"
}{
"detail": {
"code": "production_api_not_approved",
"message": "This workspace is not yet approved for Production API calls. Request production access in Settings → API. Sandbox stays open meanwhile."
}
}{
"detail": {
"code": "document_too_long",
"message": "modele_j has 20 pages; a KYB document is read up to 12."
}
}{
"detail": {
"code": "sandbox_specimen_required",
"message": "Sandbox only accepts specimen documents. Use Production for real documents."
}
}{
"detail": {
"code": "sandbox_daily_cap_reached",
"message": "Sandbox fair use is 200 documents a day per workspace; 200 read today. Retry after 00:00 UTC, or use Production.",
"current": 200,
"limit": 200
}
}{
"code": "internal_error",
"message": "An unexpected error occurred",
"details": null
}{
"detail": {
"code": "reader_unavailable",
"message": "The document reader could not be reached. Nothing was billed; retry."
}
}Onboard a Moroccan company
Required scope: kyb:onboard.
Send a Moroccan company’s KYB file as multipart: the Modèle J (or Modèle 7) and the manager’s CIN are required, the DGI identifier attestation (attestation_if) and the CIN back (cin_back) are optional. The three documents are read in parallel and the answer is synchronous: the company, its tax id, the manager, the checks, whether the CIN holder is one of the gérants, a sanctions and PEP screening, a decision (auto_ok or manual_review) with its reasons, and the evidence behind each value.
Billed per document sent (the CIN front and back count as one): 2 documents, or 3 with the attestation. A document the reader could not reach is not billed; if none could be read the call answers 503 reader_unavailable with Retry-After: 30 and nothing is billed. Nothing about the manager is stored; an auto_ok file’s ICE, company name and address are kept for this workspace’s later /v1/kyb/ma/ice-check calls.
Choose the environment with the X-Sahl-Environment header or the environment field/parameter; the Sandbox is the default. Two values that disagree are refused (422 environment_conflict). In Production the workspace must be approved by Sahl (403 production_api_not_approved until then), its subscription must be active (403 production_requires_paid_plan), and a Free workspace needs a verified work email (403 work_email_required). The Sandbox is always open.
A workspace created on or after 2026-10-24 reads only specimen documents in the Sandbox: take them from GET /v1/sandbox/specimens. Anything else answers 422 sandbox_specimen_required; use Production for real documents.
curl --request POST \
--url https://app.sahlfinancial.com/api/v1/kyb/ma/onboard \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form modele_j=@example-file \
--form cin=@example-file \
--form 'attestation_if=<string>' \
--form 'cin_back=<string>' \
--form 'reference=<string>' \
--form 'environment=<string>'const form = new FormData();
form.append('modele_j', '<string>');
form.append('cin', '<string>');
form.append('attestation_if', '<string>');
form.append('cin_back', '<string>');
form.append('reference', '<string>');
form.append('environment', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://app.sahlfinancial.com/api/v1/kyb/ma/onboard', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.sahlfinancial.com/api/v1/kyb/ma/onboard"
files = {
"modele_j": ("example-file", open("example-file", "rb")),
"cin": ("example-file", open("example-file", "rb"))
}
payload = {
"attestation_if": "<string>",
"cin_back": "<string>",
"reference": "<string>",
"environment": "<string>"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text){
"kyb_id": "9c1d6e22-8b3f-4a57-a0d4-5e2f7b1c3a68",
"environment": "sandbox",
"reference": "company-0001",
"document_kind": "modele_j",
"company": {
"raison_sociale": "SPECIMEN SARL",
"forme_juridique": "SARL",
"ice": "001234567000062",
"rc_number": "123456",
"tribunal": "Casablanca",
"siege_social": "1 Rue de l'Exemple, Casablanca",
"capital": "100000",
"date_creation": "2020-01-15",
"activite": "Conseil",
"gerants": [
{
"nom": "CLIENT",
"prenom": "Test",
"nom_ar": null,
"cin": "BK123456",
"qualite": "Gérant"
}
]
},
"tax": {
"if_number": "12345678"
},
"manager": {
"nom": "CLIENT",
"prenom": "Test",
"nom_ar": null,
"cin_number": "BK123456",
"date_naissance": "1988-04-12",
"expiry": "2030-05-01"
},
"checks": [
{
"key": "documents_read",
"status": "pass",
"message": "All documents were read."
},
{
"key": "ice_format",
"status": "pass",
"message": "ICE has 15 digits."
}
],
"gerant_match": {
"matched": true,
"gerant_index": 0,
"score": 1,
"method": "cin_number",
"reason": null
},
"decision": "auto_ok",
"reasons": [],
"screening": {
"status": "pass",
"matches": []
},
"evidence": {
"company.ice": {
"status": "valid",
"confidence": 0.98,
"evidence": "agreement",
"source": "modele_j",
"corroborated_by": [
"attestation_if"
]
}
},
"documents": [
{
"role": "modele_j",
"sent": true,
"filenames": [
"specimen-modele-j.pdf"
],
"content_types": [
"application/pdf"
],
"read": true,
"reader_unavailable": false,
"fields_read": 11,
"latency_ms": 5200,
"model_calls": 1
}
],
"reader_unavailable": false,
"company_record": "stored",
"billing": {
"documents_billed": 3,
"environment": "sandbox"
},
"latency_ms": 7400
}{
"detail": {
"code": "empty_file",
"message": "modele_j is empty."
}
}{
"detail": "Invalid or revoked API key"
}{
"detail": {
"code": "production_api_not_approved",
"message": "This workspace is not yet approved for Production API calls. Request production access in Settings → API. Sandbox stays open meanwhile."
}
}{
"detail": {
"code": "document_too_long",
"message": "modele_j has 20 pages; a KYB document is read up to 12."
}
}{
"detail": {
"code": "sandbox_specimen_required",
"message": "Sandbox only accepts specimen documents. Use Production for real documents."
}
}{
"detail": {
"code": "sandbox_daily_cap_reached",
"message": "Sandbox fair use is 200 documents a day per workspace; 200 read today. Retry after 00:00 UTC, or use Production.",
"current": 200,
"limit": 200
}
}{
"code": "internal_error",
"message": "An unexpected error occurred",
"details": null
}{
"detail": {
"code": "reader_unavailable",
"message": "The document reader could not be reached. Nothing was billed; retry."
}
}Authorizations
API key created in the console. Scopes: kyc:extract, kyc:verify, kyc:eid; kyb:onboard, kyb:ice; statements:read; webhooks:manage; requests:read, requests:write; bank:read, bank:write (Growth plan, enabled per workspace by Sahl); registry:read; cases:read; scoring:read, scoring:write; policy:read, policy:write; usage:read. The Sandbox specimen routes, GET /v1/partner/me and GET /v1/partner/errors need any valid key.
Headers
Body
Multipart form. Files: PDF, JPEG, PNG, WebP or TIFF, up to 30 MB each.
Response
OK
Whether the company's ICE, name and address were kept for later ICE checks. Only an auto_ok file with a valid ICE key that reads the same on both documents is kept; conflict: the ICE is already kept under another name and nothing was overwritten.
stored, updated, not_stored, conflict For each output field (company.ice, tax.if_number, manager.cin_number, ...): status (valid, needs_review or missing), confidence, evidence (how the value is backed, for example validator, agreement, model), source (modele_j, attestation_if or cin), plus note when a validation message applies and corroborated_by on the ICE when the IF attestation agrees.