DiOTP Postman Collection
Try the DiOTP OTP API in Postman in a few minutes: import one file, paste your API key, send a code to your phone and verify it.
What the collection contains
The collection is a single JSON file in Postman Collection v2.1 format. It holds one request for each customer endpoint of the DiOTP API, ready to run, so you can see real responses before you write any code. It is the quickest way to check that your API key works, to show a teammate how the OTP flow behaves, or to reproduce an error before you write to support.
| Request | Endpoint | What it does |
|---|---|---|
| Send OTP | POST /otp/send | Sends a code and saves request_id for the next step. |
| Verify OTP | POST /otp/verify | Checks the code you received against the saved request_id. |
| Get account (me) | GET /me | Shows the account status and which key you are using. |
| Get usage | GET /usage | Shows attempts, accepted messages and the amount for a month. |
Two collection variables drive everything. baseUrl is set to https://api-diotp.diorbit.com/v1, and apiKey is empty until you fill it in. The collection uses Bearer authentication with {{apiKey}}, so every request inherits it and you never paste the key into individual requests. A third variable, requestId, is set for you.
How to import it
- Download diotp.postman_collection.json to your computer, or fork it from our public Postman workspace and skip the next two steps.
- Open Postman (the desktop app or the web version) and click Import at the top of the sidebar.
- Pick the file you downloaded, or drag it into the import window. The DiOTP API collection appears in your workspace.
- Click the collection, open the Variables tab, and paste your API key into the Current value of
apiKey. Save. - Open Send OTP, put your own mobile number in
to, and click Send. - When the SMS arrives, open Verify OTP, replace
482913with your code, and click Send. A 200 with"verified": truemeans it worked.
Get your key from API keys in your dashboard. If you do not have an account yet, create one for free test messages. New accounts are in test mode, which only sends to the mobile number you verified at sign-up. Any other number returns 403 trial_restricted.
The scripts that link send and verify
Send OTP has a small pre-request script that adds a fresh Idempotency-Key header on each run, and a test script that reads the response and stores request_id in the collection variable requestId. Verify OTP sends {{requestId}} in its body, so you do not copy ids by hand.
const body = pm.response.json();
if (body.request_id) {
pm.collectionVariables.set('requestId', body.request_id);
}If a send fails, the script logs the error code to the Postman console instead. Common ones while testing are resend_cooldown (wait 30 seconds between codes to one number) and phone_hourly_limit (3 codes per number per hour). The full list of codes for each request is in the OpenAPI reference.
Import into your workspace
Download the file above and import it into any Postman workspace: you get the requests, variables and scripts ready to run.
Keep your key safe
Keep the key in the current (local) value only. Postman shares a variable's initial (shared) value with anyone who can see the collection or workspace, so never type a key there. If you export the collection to share it, check that apiKey is empty in the file. If a key leaks, revoke it from API keys in the dashboard and create a new one. When you move from Postman to your own code, the API documentation has samples in cURL, Node.js, Python and PHP, and the send OTP guide covers retries and limits in more detail.
Postman collection: FAQ
Download diotp.postman_collection.json from this page. In Postman, click Import, choose the file, and the DiOTP API collection appears in your workspace. Then set the apiKey variable on the collection.
Open the collection, go to the Variables tab and paste your key into the Current value of apiKey. The collection uses Bearer auth with that variable, so every request picks it up. Current values stay on your machine unless you choose to share them.
requestId is filled in by the test script on Send OTP. Run Send OTP first and check that it returned 200. If the send failed, the response shows an error code such as trial_restricted instead of a request_id.
Download the collection file and use Import in Postman. The file holds the four requests, the variables and the scripts.
