Give a PIN a new code
Give a PIN a new code when its customer has lost theirs. The PIN, its balance, expiry and history stay the same; the old code stops working straight away.
HMAC-signed request with a unique Idempotency-Key header. Authentication
$afropin->brand->pins->newCode($params)afropin.brand.pins.newCode(params)afropin.brand.pins.new_code(params)afropin.brand().pins().newCode(params)Body parameters
The PIN pin_id. It must belong to your account and to the mode of your API key, and be active.
Response fields
The PIN's new code. Give it to your customer the way you deliver codes today, after checking it is really them.
The new code with its middle digits hidden.
The mask of the code that just stopped working.
The PIN's balance, unchanged.
The customer on the PIN, as when it was issued. It can't be changed, so a new code always belongs to the same customer.
When the code was replaced, ISO 8601 in UTC.
pin_code is the only time you will see this code. Save it securely before you respond to your customer: we keep only a one-way fingerprint of it, so a lost code can never be shown again. If your customer loses it, reissue the PIN to give it a new code; the balance is kept.
Storing PIN codes
pin.code_changed event with the new code. When the PIN has handle_delivery on, we also send the customer the new code for you. How delivery works. You can also reissue from the PIN's page in your dashboard, which emails the customer without showing the code to anyone.reissue_limit_reached.Request
{
"pin_id": "e83f72e0-997c-4ca8-aee8-04a7423a1bd4"
}
Response 200
{
"ok": true,
"data": {
"pin_id": "e83f72e0-997c-4ca8-aee8-04a7423a1bd4",
"pin_code": "2923-5810-4476-1441",
"pin_mask": "2923-****-****-1441",
"previous_pin_mask": "3093-****-****-3097",
"balance": 6000,
"currency": "NGN",
"status": "active",
"mode": "live",
"customer": {
"first_name": "Ada",
"last_name": "Okafor",
"email": "[email protected]",
"phone": null
},
"expires_at": "2027-10-28T09:14:22.000000Z",
"reissued_at": "2026-10-28T09:14:22.000000Z"
}
}
Errors
Failed requests return a stable code with a translated message. Branch on code, never on the message.
validation_error
Some fields are missing or invalid
wrong_account_type
Your account type cannot use this endpoint
rate_limited
Too many requests. Wait a moment and try again
pin_not_found
No PIN has this id
pin_expired
This PIN has expired
pin_blocked
This PIN is blocked
reissue_limit_reached
This PIN's code has been reissued too many times today. Try again tomorrow
pin_generation_failed
A new PIN code could not be created. Try again
internal_error
Something went wrong on our side. Try again; if it keeps happening, contact support
{
"ok": false,
"error": {
"code": "pin_not_found",
"message": "No PIN has this id",
"fields": null
}
}
All error codes →