Anything you can do on an end user’s page in the portal, your systems can do
under /end-users. The full reference lists every call and
its fields.
Naming an end user
Name an end user by their end-user number, the one shown on their page. A number that isn’t one of yours answers 404, the same as one that doesn’t exist.
Scopes
| Scope | What it covers |
|---|---|
end-users:read |
Listing and reading end users, their services, settings, notes, logins and representatives. Finding one from a caller’s details. |
end-users:create |
Creating them, one at a time or in an import. |
end-users:update |
Changing their details, addresses and settings. Suspending and archiving. Notes, logins, representatives and identity codes. |
end-users:sign-in |
Making a link that signs one of their logins in to your end-user portal. |
Anything that gives or widens a way into the end-user portal needs
end-users:sign-in as well as end-users:update. That covers inviting a
login, resending an invite, changing a login’s role and sending a password
reset. Removing a login or revoking an invite only takes access away, so
end-users:update is enough for those.
A key acts for your whole account, so a partner’s limits in the portal don’t apply to it. Every change goes in the audit log, naming the key.
Contacts withheld by a safety record
While a family violence safety record withholds an end user’s contacts, the
API withholds them the same way the portal does. contactsMasked is true,
and their email, phone and addresses are null. A search never matches the
withheld email. A change to a withheld contact is refused.
Addresses and the emergency record
Change addresses with PATCH /end-users/{endUser}/addresses, not with the
end user’s details. The service address is also the address emergency
services get for their numbers. ipnd in the answer tells you what happened
to that record:
ipnd |
When |
|---|---|
applied |
You sent the gnafId of an address from address search. |
referred |
The address was typed in. Confirm their emergency address yourself. |
unchanged |
Only the billing address changed. |
Importing many at once
POST /end-users/imports takes the same CSV file as the portal’s
import as a file upload. You can also send the same
columns as a JSON list of rows. It runs the same checks and duplicate
rules as the portal.
Send an Idempotency-Key. It is required on this call, so a retry never
imports the rows twice.
validateOnly: truechecks the rows and creates nothing, like Check File in the portal.sendWelcome: falseholds back the welcome email to each new end user.- Up to 200 rows are imported straight away. The answer gives each row’s
outcome:
created,skippedfor a duplicate, orfailedwith the reason. - More than that runs in the background and answers
202. ReadGET /end-users/imports/{importId}until itsstatusisfinished. The status isfailedif the run stopped part-way, or hadn’t started an hour after you sent it. Its counts and rows show what it did write. Send the rows again with a newIdempotency-Keyto create the rest. The rows already created are skipped.
GET /end-users/imports lists every import on your account, including the
ones made in the portal.
Sending an end user to their portal
POST /end-users/{endUser}/portal-sessions makes a link that signs one of the
end user’s logins in to your end-user portal. It opens the page you choose:
their dashboard, their bills, one bill with invoiceId, one service
with assignmentId, or their support tickets. Use it to send them to pay by
card or direct debit, for example, which only the end-user portal takes.
- The link works once, for five minutes, on your portal’s own domain. Opening it shows a Continue to your portal button, and only the button uses the link up. A mail scanner or link preview that opens it first leaves it working.
portalUseris required and names the login it signs in as. Take the id from the end user’s logins. There is no default login.- With
returnUrl, they go there once signed in instead of to the page. It must be anhttpsaddress on your own website or your end-user portal’s domain. Any other address is refused. - The link replaces the password, never two-factor. A login with two-factor on is asked for its code before the page opens.
- An end user who can’t use the portal is refused with
403and the codeno_end_user_portal_access. That happens when the portal is off, or when they have no active login. - Each link goes in the audit log, naming the key and the login.
Searching across your records
GET /search?q= works like the search at the top of the portal. It finds a
number, trunk, data service, order, end user, port, emergency address, ticket
or invoice from a phone number, email, name or reference in one call. It
searches each type only when the key holds that type’s read scope. An end
user needs end-users:read, and an invoice needs billing:read. An end user
whose contacts a safety record withholds is found by name or number only,
never by email or phone.
Finding an end user from a caller’s details
POST /end-users/lookup takes what the caller tells you: their name, email,
phone, ABN or service address. It answers with an end user only when at
least three details match and only one end user fits. Every other case gets
the same 404, so nobody can use the call to try details one at a time.
Each key can make 20 lookups a minute. Each call is audited with the fields sent, never their values.
For an end user whose contacts a safety record withholds, their email, phone and service address never count towards a match. The lookup can’t confirm them, and answers the same 404 as for no one.
Checking who you are talking to
POST /end-users/{endUser}/verification-codes sends a six-digit code to the
end user’s own mobile (sms) or email, with your reason. You never supply
the address. The code goes to the contact on
file. The SMS comes from your approved SMS sender, and the email is in your
branding. If you have more than one sender, name it in smsFrom. The answer
shows where the code went, masked.
Ask the caller to read the code back. Check it with
POST /end-users/{endUser}/verification-codes/{verificationId}/verify.
verified is true for the right code. A wrong code, a used or expired one,
or one with five wrong tries all get the same verified: false.
- A code lasts 10 minutes. At most five go to one end user in an hour.
- A right code records
lastVerifiedAton the end user. Nothing else depends on it. Whether you ask for a code is up to your own process. - While a family violence safety record is active, the code goes only to the safe contact agreed on the record. It is refused when there is none for that channel.
- Each send and check goes in the audit log with the reason, the key and the outcome, never the code.
Keys for one end user
Fax
A key for one end user can hold fax:read and fax:send. It reaches only
these calls, and only for that end user:
GET /fax/documentsandGET /fax/documents/{id}read only the faxes sent and received on that end user’s numbers. Any other fax answers 404, the same as one that doesn’t exist.GET /fax/plansandGET /fax/plans/{planId}read only that end user’s fax plans. Any other plan answers 404.POST /fax/documentssends only from a number on one of that end user’s fax plans. Any other number is refused onfromas a number on no plan.
Each fax it sends is recorded against that end user. It shows in their fax
history, and their own webhook endpoints get its fax.* events. We bill it
to you as usual, under the end user’s fax plan, so your end-user billing
picks it up.
Fax settings, sender addresses and changes to a plan stay with your own
keys. Such a key can’t hold fax:create, fax:update or fax:delete.
SMS
A key limited to one end user works with that end user’s own SMS only.
GET /sms,GET /sms/{number}andGET /sms/messages/{messageId}show only the messages recorded against them. Your own messages and your other end users’ answer 404, or are left out of a list.POST /smsandPOST /sms/bulksend only from their own senders. That is a mobile number they hold, or a sender they asked for and we approved. Any other sender is refused with403sender_not_approved, the same as an unapproved one.- Each message they send is recorded against them. It is billed to you as now, and counts on their bill, their spend and their usage.
GET /sms/senderslists the senders they asked for and the mobile numbers they hold.POST /sms/sendersasks for a sender as them, and our team approves it as any other request.DELETE /sms/senders/{id}withdraws only their own requests.GET /numbers/{number}/sms-deliveryandPUT /numbers/{number}/sms-deliveryread and set where a number’s inbound SMS go. They needsms:readandsms-delivery:update. Only a number they hold answers. Any other answers 404.
Webhooks
A key limited to one end user can register webhook endpoints for that end
user under /webhooks. It needs the webhooks:* scopes for each call, as
your own keys do.
- Its endpoints get only that end user’s SMS and fax events. These are
sms.received,sms.delivered,sms.failed,fax.received,fax.sentandfax.failed. Each carries the samedataas on your own endpoints. The delivery leaves outaccountId, your account number. Tests, redeliveries and replays leave it out too. eventsmay list only those types. Any other type, or*, is refused with422.GET /webhooks/event-typeslists only them for this key.- It cannot set
filters. - One end user can have up to 5 endpoints. They don’t count towards your account’s 25. A URL you already use is free for them.
- The key lists, reads, changes, tests and deletes only that end user’s
endpoints and their deliveries. Your own endpoints, and another end user’s,
answer
404as a missing one does. - Deliveries stop while Allow API keys is off for the end user, or the end
user is suspended or archived. Events in that time are not sent to their
endpoints later. A delivery already queued is not sent either. It is
recorded as
deadand doesn’t count towards turning the endpoint off. - Test, redeliver and replay-dead calls from the end user’s keys have their own limit of 10 a minute for that end user. They never use up yours or another end user’s.
- The event feed under
/eventsis not open to this key.
/webhooks with your own keys, and the portal’s Webhooks page, show only
your endpoints, never an end user’s. To see an end user’s, use
GET /end-users/{endUser}/webhooks with webhooks:read. To remove one, use
DELETE /end-users/{endUser}/webhooks/{webhookId} with webhooks:delete.
You can do the same on the end user’s page in the portal. You can’t change
or test them. Your own endpoints still get every event, the end user’s SMS
and fax included.