API v1Postman Collection v2.1

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.

RequestEndpointWhat it does
Send OTPPOST /otp/sendSends a code and saves request_id for the next step.
Verify OTPPOST /otp/verifyChecks the code you received against the saved request_id.
Get account (me)GET /meShows the account status and which key you are using.
Get usageGET /usageShows 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

  1. Download diotp.postman_collection.json to your computer, or fork it from our public Postman workspace and skip the next two steps.
  2. Open Postman (the desktop app or the web version) and click Import at the top of the sidebar.
  3. Pick the file you downloaded, or drag it into the import window. The DiOTP API collection appears in your workspace.
  4. Click the collection, open the Variables tab, and paste your API key into the Current value of apiKey. Save.
  5. Open Send OTP, put your own mobile number in to, and click Send.
  6. When the SMS arrives, open Verify OTP, replace 482913 with your code, and click Send. A 200 with "verified": true means 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.

Test script on Send OTP
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.