Skip to Content

Buyers

List buyers

GET /i/v1/buyers

buyer.read. Live buyers of the organization in the token’s mode, filtered by search (name, legal name or tax id) and taxIdStatus; page and limit (up to 100).

Who can call it: API key or signed-in user.

Parameters

NameInTypeRequiredDescription
searchquerystringNoName, legal name or tax id. A tax id may be typed with its hyphen, without it, or in groups. At most 100 characters.
taxIdStatusquerystringNoOne of unverified | pending | verified | not_found | name_mismatch | unavailable | valid_off_network | checking.
pagequerynumberNoDefault: 1. At least 1.
limitquerynumberNoDefault: 20. Between 1 and 100.

Example request

bash
curl https://gp.useyona.com/i/v1/buyers \
  -H "Authorization: Bearer sk_test_your_key_here"

Responses

One page of buyers, meta.pagination set.

Errors: 400, 401, 403, 429, 500, 503


Create a buyer

POST /i/v1/buyers

buyer.create; charged per buyer before it is saved (refunded if the save fails). A taxId is checked against the jurisdiction’s format and must not be held by another live buyer of the organization. Status fields (taxIdStatus and the like) cannot be sent: they are set by the verification.

Who can call it: API key or signed-in user.

Request body

FieldTypeRequiredDescription
namestringYesThe buyer’s name. 1 to 255 characters.
legalNamestring or nullNoThe buyer’s registered legal name. At most 255 characters.
taxIdstring or nullNoThe buyer’s tax id, stored as sent (trimmed). Checked against the jurisdiction’s format for its taxIdType (Nigeria, a TIN: 12345678-0001 or 10–13 digits), else 400 VAL003; another live buyer of the organization holding it is 409 RES002. At most 64 characters.
taxIdTypestringNoDefaults to tin when a taxId is sent; none when there is none. One of tin | rn | foreign | none.
emailstring or nullNoThe buyer’s email address. At most 320 characters.
phonestring or nullNoE.164.
addressobject (BuyerAddress) or nullNoThe buyer’s postal address.
partyTypestring or nullNoThe kind of party. One of individual | company | partnership | non_profit | government.
businessDescriptionstring or nullNoWhat the buyer does. At most 1000 characters.
referencestring or nullNoThe tenant’s own reference for this buyer. At most 100 characters.

address

FieldTypeRequiredDescription
line1stringYesThe first address line. 1 to 255 characters.
line2stringNoThe second address line; empty is the same as absent. At most 255 characters.
citystringYesThe city or town. 1 to 100 characters.
statestringNoFor a Nigerian address, a state from GET /i/v1/invoices/resources/states: its code (NG-LA) or its name (Lagos). Stored and returned as the code. Not on the list → 400 VAL202. Free text for other countries. At most 100 characters.
lgastringNoLocal government area. For a Nigerian address, an LGA from GET /i/v1/invoices/resources/lgas whose stateCode is the address’s state: its code (NG-LA-IKE) or its name (Ikeja). Stored and returned as the code. Not on the list, or not in that state → 400 VAL203. Sent without a state, an unambiguous LGA fills the state in. At most 100 characters.
postalCodestringNoThe postal code; empty is the same as absent. At most 20 characters.
countrystringYesISO 3166-1 alpha-2.

Example request

bash
curl -X POST https://gp.useyona.com/i/v1/buyers \
  -H "Authorization: Bearer sk_test_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Adebayo Trading",
    "legalName": "Adebayo Trading Limited",
    "taxId": "12345678-0001",
    "taxIdType": "tin",
    "email": "accounts@example.com",
    "phone": "+2348098765432",
    "partyType": "company",
    "businessDescription": "Wholesale distributor of building materials",
    "reference": "CUST-0042"
  }'

Responses

The new buyer.

Errors: 400, 401, 402, 403, 409, 413, 415, 429, 500, 503


Get a buyer

GET /i/v1/buyers/{id}

buyer.read. An archived buyer is readable by id (archivedAt set).

Who can call it: API key or signed-in user.

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)Yes

Example request

bash
curl https://gp.useyona.com/i/v1/buyers/9f8e7d6c-5b4a-3210-fedc-ba9876543210 \
  -H "Authorization: Bearer sk_test_your_key_here"

Responses

The buyer.

Errors: 400, 401, 403, 404, 429, 500, 503


Update a buyer

PATCH /i/v1/buyers/{id}

buyer.update. The create fields, all optional; an optional field sent as null is cleared, name can be changed but not cleared. Charged only when the edit changes something. A changed tax identity resets the verification.

Who can call it: API key or signed-in user.

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)Yes
Idempotency-KeyheaderstringNo8–128 characters of A–Z, a–z, 0–9, _ or -. A retry with the same key is not charged twice.

Request body

FieldTypeRequiredDescription
namestringNoThe buyer’s name; it can be changed, not cleared. 1 to 255 characters.
legalNamestring or nullNoThe buyer’s registered legal name; null clears it. At most 255 characters.
taxIdstring or nullNoA new tax id, checked as on create; null removes it (taxIdType becomes none). A changed tax identity resets the verification. At most 64 characters.
taxIdTypestringNoThe tax id’s type. A new taxId sent without it keeps the buyer’s current type (tin when it had none); none goes with taxId: null. One of tin | rn | foreign | none.
emailstring or nullNoThe buyer’s email address; null clears it. At most 320 characters.
phonestring or nullNoE.164; null clears it.
addressobject (BuyerAddress) or nullNoReplaces the whole address; null clears it.
partyTypestring or nullNoThe kind of party; null clears it. One of individual | company | partnership | non_profit | government.
businessDescriptionstring or nullNoWhat the buyer does; null clears it. At most 1000 characters.
referencestring or nullNoThe tenant’s own reference for this buyer; null clears it. At most 100 characters.

address

FieldTypeRequiredDescription
line1stringYesThe first address line. 1 to 255 characters.
line2stringNoThe second address line; empty is the same as absent. At most 255 characters.
citystringYesThe city or town. 1 to 100 characters.
statestringNoFor a Nigerian address, a state from GET /i/v1/invoices/resources/states: its code (NG-LA) or its name (Lagos). Stored and returned as the code. Not on the list → 400 VAL202. Free text for other countries. At most 100 characters.
lgastringNoLocal government area. For a Nigerian address, an LGA from GET /i/v1/invoices/resources/lgas whose stateCode is the address’s state: its code (NG-LA-IKE) or its name (Ikeja). Stored and returned as the code. Not on the list, or not in that state → 400 VAL203. Sent without a state, an unambiguous LGA fills the state in. At most 100 characters.
postalCodestringNoThe postal code; empty is the same as absent. At most 20 characters.
countrystringYesISO 3166-1 alpha-2.

Example request

bash
curl -X PATCH https://gp.useyona.com/i/v1/buyers/9f8e7d6c-5b4a-3210-fedc-ba9876543210 \
  -H "Authorization: Bearer sk_test_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Adebayo Trading",
    "legalName": "Adebayo Trading Limited",
    "taxId": "12345678-0001",
    "taxIdType": "tin",
    "email": "accounts@example.com",
    "phone": "+2348098765432",
    "partyType": "company",
    "businessDescription": "Wholesale distributor of building materials",
    "reference": "CUST-0042"
  }'

Responses

The buyer after the edit.

Errors: 400, 401, 402, 403, 404, 409, 413, 415, 429, 500, 503


Delete a buyer

DELETE /i/v1/buyers/{id}

buyer.delete. Deleted, or archived instead when an issued invoice names the buyer (outcome says which).

Who can call it: API key or signed-in user.

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)Yes

Example request

bash
curl -X DELETE https://gp.useyona.com/i/v1/buyers/9f8e7d6c-5b4a-3210-fedc-ba9876543210 \
  -H "Authorization: Bearer sk_test_your_key_here"

Responses

What happened to the buyer.

Errors: 400, 401, 403, 404, 429, 500, 503


Delete several buyers

DELETE /i/v1/buyers/bulk

buyer.delete. Up to 100 distinct ids, each handled like a single delete: deleted, or archived when an issued invoice names the buyer. Ids that are not found are listed, not refused.

Who can call it: API key or signed-in user.

Request body

FieldTypeRequiredDescription
idsarray of string (uuid)YesThe buyers to delete: 1 to 100 ids, each once. 1 to 100 items.

Example request

bash
curl -X DELETE https://gp.useyona.com/i/v1/buyers/bulk \
  -H "Authorization: Bearer sk_test_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "ids": [
      "6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f",
      "8a2b3c4d-5e6f-4a7b-9c8d-1e2f3a4b5c6d"
    ]
  }'

Responses

Which ids were deleted, archived or not found.

Errors: 400, 401, 403, 413, 415, 429, 500, 503


Check whether a TIN is on the e-invoicing network

GET /i/v1/buyers/reachability

buyer.read; free. Whether the tax authority’s e-invoicing network reaches this TIN — the check a form runs while a buyer TIN is typed. Cached per mode and TIN. When the tax authority cannot be asked the answer is still 200: an earlier answer with stale: true, or unavailable: true.

Who can call it: API key or signed-in user.

Parameters

NameInTypeRequiredDescription
taxIdquerystringYesThe TIN to ask about, checked against the jurisdiction’s format (Nigeria: 12345678-0001 or 10–13 digits), else 400 VAL003. 1 to 32 characters.

Example request

bash
curl "https://gp.useyona.com/i/v1/buyers/reachability?taxId=33875194-0001" \
  -H "Authorization: Bearer sk_test_your_key_here"

Responses

The lookup’s answer.

Errors: 400, 401, 403, 422, 429, 500, 503


Ask the tax authority about a TIN now

POST /i/v1/buyers/reachability/check

buyer.read; charged per request (refunded when no answer could be had). The same question as the free reachability check, asked afresh rather than from the cache. When the tax authority cannot be asked the answer is 200 with unavailable: true.

Who can call it: API key or signed-in user.

Parameters

NameInTypeRequiredDescription
Idempotency-KeyheaderstringNo8–128 characters of A–Z, a–z, 0–9, _ or -. A retry with the same key is not charged twice.

Request body

FieldTypeRequiredDescription
taxIdstringYesThe TIN to ask about, checked against the jurisdiction’s format (Nigeria: 12345678-0001 or 10–13 digits), else 400 VAL003. 1 to 32 characters.

Example request

bash
curl -X POST https://gp.useyona.com/i/v1/buyers/reachability/check \
  -H "Authorization: Bearer sk_test_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "taxId": "33875194-0001"
  }'

Responses

The lookup’s answer.

Errors: 400, 401, 402, 403, 409, 413, 415, 422, 429, 500, 503


Search buyers

GET /i/v1/buyers/search

buyer.read. Live buyers whose name, legal name or tax id matches q (at least 2 characters); at most limit (default 10, up to 20).

Who can call it: API key or signed-in user.

Parameters

NameInTypeRequiredDescription
qquerystringYes2 to 100 characters.
limitquerynumberNoDefault: 10. Between 1 and 20.

Example request

bash
curl "https://gp.useyona.com/i/v1/buyers/search?q=string" \
  -H "Authorization: Bearer sk_test_your_key_here"

Responses

The matching buyers.

Errors: 400, 401, 403, 429, 500, 503


Get the buyer form options

GET /i/v1/buyers/setup

buyer.read. The party types, the tax-id types of the organization’s jurisdiction, and the countries.

Who can call it: API key or signed-in user.

Example request

bash
curl https://gp.useyona.com/i/v1/buyers/setup \
  -H "Authorization: Bearer sk_test_your_key_here"

Responses

The option lists.

Errors: 401, 403, 429, 500, 503


Get a buyer’s tax number verification status

GET /i/v1/buyers/{id}/verification-status

buyer.read. The latest verification and the buyer’s tax-id status.

Who can call it: API key or signed-in user.

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)Yes

Example request

bash
curl https://gp.useyona.com/i/v1/buyers/9f8e7d6c-5b4a-3210-fedc-ba9876543210/verification-status \
  -H "Authorization: Bearer sk_test_your_key_here"

Responses

The latest verification.

Errors: 400, 401, 403, 404, 429, 500, 503


Verify a buyer’s tax number

POST /i/v1/buyers/{id}/verify-tax-number

buyer.verify_tax_id; a charge is held while the check runs. 202 when a new verification starts; 200 with the one already pending. Follow it with the verification status route.

Who can call it: API key or signed-in user.

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)Yes

Example request

bash
curl -X POST https://gp.useyona.com/i/v1/buyers/9f8e7d6c-5b4a-3210-fedc-ba9876543210/verify-tax-number \
  -H "Authorization: Bearer sk_test_your_key_here"

Responses

A verification was already pending; this is it.

A new verification was started.

Errors: 400, 401, 402, 403, 404, 409, 422, 429, 500, 503