Skip to Content
GuidesOnboard your businesses

Onboard your businesses by API

A platform or group that brings many businesses to Yona can take each one from created to waiting for approval with five calls. Yona calls this managed onboarding: your organization manages the setup, and the business owner confirms it. The business owner then does two short things on a link Yona hosts: proves the business phone with a code sent by SMS, and, once Yona has approved the business, gives the consent that lets Yona report its e-invoices to NRS.

Nothing a person had to prove before is skipped. The phone check is the owner’s, the approval is a Yona reviewer’s, and the consent is the owner’s.

Who does what

WhoDoes
Your Owner or Admin, onceAccepts the managed onboarding terms in the Yona app and creates a live key with the permissions below
Your key, for each businessCreates it, sends its Tax ID and contact details, creates its setup link, asks for the review
The business owner, first visitOpens the link and enters the code Yona texts to the business phone
YonaReviews the business and approves it
The business owner, second visitOpens the same link, enters a fresh code, gives the NRS consent with their name and role, follows the NRS portal steps and uploads the NRS key
YouHear each step on one webhook endpoint

The same steps can be done without code: in the Yona app, Sub-organizations, Add businesses takes a CSV file and runs them for each row.

Before you start

  • Your organization is approved for live, and its plan has room for the businesses you will add. Each business is a sub-organization of yours.
  • An Owner or Admin has accepted the managed onboarding terms. This is done once, signed in to the Yona app in live mode, on the Sub-organizations page. With them your organization accepts Yona’s terms on behalf of the businesses it onboards. GET /a/v1/organizations/me/group-terms answers where you stand: accepted is true only for the current version.
  • A live key with three permissions. When you create the key in the Yona app, tick all three under Sub-organizations:
CapabilityAllows
organization.children.readListing your businesses and reading their readiness
organization.children.createCreating a business
organization.children.onboardThe onboarding steps on this page

None of them is part of a key preset, and only an Owner or an Admin can add them. A sandbox key is refused with 403 BIZ003: businesses are onboarded for live.

The five calls

1. Create the business

POST /a/v1/organizations

bash
curl -X POST https://gp.useyona.com/a/v1/organizations \
-H "Authorization: Bearer sk_live_your_key_here" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: create-crm-0042" \
-d '{
  "businessName": "Bola Stores Limited",
  "email": "accounts@bolastores.example",
  "phoneNumber": "+2348031234567",
  "externalReference": "crm-0042"
}'
FieldNotes
businessNameRequired. The name as it is registered: the Tax ID check in the next step compares it with the registry’s
emailRequired. The business’s contact email
phoneNumberOptional here, in international form (+234…). The contact step sets it
externalReferenceOptional. Your own id for this business: 1 to 64 letters, digits, ., _, : or -. Unique among your businesses and never changed

The answer is 201 with the business. Keep its id: every later call names it. origin is parent_key and onboardingManaged is true, which is what lets your key take the next steps.

2. Verify its Tax ID

POST /a/v1/organizations/me/children/{id}/onboarding/tax-id

bash
curl -X POST \
https://gp.useyona.com/a/v1/organizations/me/children/BUSINESS_ID/onboarding/tax-id \
-H "Authorization: Bearer sk_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "businessName": "Bola Stores Limited", "taxNo": "1234567890123" }'

taxNo is the 13 digit Tax ID, or a TIN written as 12345678-0001. Yona checks it with the tax registry and compares the registered name with businessName. The answer is 200 with tinStatus: "verified" and the legalName the registry holds.

Which number to send. Send the business’s TIN (12345678-0001) if it has one, otherwise its 13 digit Tax ID. The NRS knows each business by one of the two, and an older business by its TIN. The business owner never signs in to Yona, so sending the TIN now saves a step later.

3. Set its contact details

PUT /a/v1/organizations/me/children/{id}/onboarding/contact

bash
curl -X PUT \
https://gp.useyona.com/a/v1/organizations/me/children/BUSINESS_ID/onboarding/contact \
-H "Authorization: Bearer sk_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "phoneNumber": "+2348031234567", "contactEmail": "accounts@bolastores.example" }'

phoneNumber is required and must be the business owner’s own phone: the codes go to it and nowhere else. Two businesses you are onboarding cannot share a number. contactEmail and address are optional.

POST /a/v1/organizations/me/children/{id}/setup-link

bash
curl -X POST \
https://gp.useyona.com/a/v1/organizations/me/children/BUSINESS_ID/setup-link \
-H "Authorization: Bearer sk_live_your_key_here" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: link-crm-0042" \
-d '{ "expiresInDays": 14 }'

The answer is 201 with url and expiresAt. A link works for 14 days unless you ask for another life, 30 days at most.

Store the link now

The address is shown once. Yona keeps only a fingerprint of it, so store it or send it to the owner straight away. A lost address cannot be read again: create a new link.

A business has one working link. Creating another stops the one before it. DELETE on the same address withdraws the working link at once.

5. Ask for the review

POST /a/v1/organizations/me/children/{id}/onboarding/submit

bash
curl -X POST \
https://gp.useyona.com/a/v1/organizations/me/children/BUSINESS_ID/onboarding/submit \
-H "Authorization: Bearer sk_live_your_key_here"

You do not have to wait for the owner. Before the phone is verified the answer says state: "awaiting_phone_verification", and the business goes to Yona’s reviewers by itself the moment the owner enters the code. With the phone already verified the answer says state: "in_review".

Yona does not send the link. You do, in whatever way your customer expects to hear from you.

On the link the owner sees your organization’s name, the business’s name and the last digits of the phone on record, and asks for a code. The code is sent by SMS to that phone only. The page asks the owner to stop if they do not know your organization.

After the first visit there is nothing more for the owner to do until Yona approves the business. Tell them to keep the link: they finish on it.

After approval

When the review ends you hear organization.child.live_access_approved or organization.child.live_access_rejected.

  • Approved. The owner opens the same link, enters a fresh code, and gives the consent with their name and role. The page then shows the steps to take on the NRS portal and takes the NRS key. Your key can make a new link for an approved business if the first is lost or has expired. It can do nothing else to it.
  • Rejected. Correct the Tax ID or the contact details with the same calls, then ask for the review again.

Hear every step

Subscribe an endpoint of your organization to these events. Each carries childOrganizationId; none carries a phone number, a name or a reviewer’s message.

EventSent when
organization.child.createdThe business is created
organization.child.tax_id_verifiedIts Tax ID is verified
organization.child.onboarding_submittedYou ask for the review
organization.child.phone_verifiedThe owner enters the code on the link, the first time
organization.child.live_access_approvedYona approves it
organization.child.live_access_rejectedYona does not approve it
organization.child.tax_connection_action_requiredAfter the consent, someone must act. state, nextAction and nextActionBy say who and what, for example enable_on_nrs by the taxpayer
organization.child.tax_connection_connectedThe business is connected to NRS and can report live invoices
organization.child.tax_connection_suspendedThe business withdrew Yona’s permission at NRS

onboarding_submitted and phone_verified can arrive in either order. An event can be delivered more than once: ignore an event id you have already handled.

Where every business stands is also one read: GET /a/v1/organizations/me/children/readiness, described in Sub-organizations.

Repeating a call is safe

The calls are made to be looped, so each can be sent again.

CallSent again
CreateWith the same Idempotency-Key, or the same externalReference and name, the answer is the business already made, with replayed: true. Nothing is created twice
Tax IDThe same number, already verified, answers the stored result with replayed: true. No second lookup is made
ContactThe same values change nothing and never undo the phone check
Setup linkWith the same Idempotency-Key, the answer names the same link with url: null and replayed: true. To get an address again, create a new link on purpose
SubmitAnswers where the business stands, with replayed: true

An Idempotency-Key is 8 to 128 letters, digits, _ or -, and is remembered for 7 days. The same key with different details is refused with 409 BIZ107.

When a call is refused

StatuserrorCodeMeaning
404RES001Not a business your key may onboard. The same answer covers an id that is not yours, a sub-organization its own people set up, and a business Yona has already approved
403BIZ003A sandbox key
403AUTH019The key does not hold organization.children.onboard, or was revoked
409BIZ004errors[0].reason says why: group_terms_not_accepted (accept the current managed onboarding terms), or in_review (nothing can change while Yona reviews the business)
409BIZ010Something is missing before this step. errors[].missing names it: tin or contact_info
409RES002errors[0] names the field: a phoneNumber another of your businesses uses, or an externalReference that names another business
409BIZ009The Tax ID is verified for another organization on Yona
422BIZ007The registry’s name for that Tax ID does not match businessName
402BIZ016Your plan has no room for another business
429BIZ002The day’s limit on Tax ID checks is reached. Try again tomorrow
503The tax registry could not be reached. Wait for Retry-After

What your key does not do

The key onboards. It does not read a business’s invoices, buyers or documents, it does not approve, and it does not give the NRS consent. Once Yona approves a business the key can only make it a new setup link. To issue invoices as a business, create a key in that business.