Skip to content
Armada Developers
Quickstart
Getting startedAPI v2

Quickstart

Create an API key, install the Node SDK and read your wallet balance.

1. Create an API key

Open Automated Ordering and create a key. New keys start with Test mode on and all permissions enabled. For this first request, keep only wallet:read, clear the other permissions and click Save changes. Copy the key and secret.

sh
export ARMADA_API_KEY=main_your_key
export ARMADA_API_SECRET=your_secret

Keep both values on your server. Use SDKs and CLI for PHP, Go or command-line installation.

2. Install the SDK

sh
npm i github:armadadelivery/armada-node#v0.1.0-beta.0

3. Make a request

Save this as wallet.mjs and run node wallet.mjs.

javascript
import { ArmadaClient } from '@armada/sdk';

const armada = new ArmadaClient({
	baseUrl: 'https://api.armadadelivery.com',
	apiKey: process.env.ARMADA_API_KEY,
	apiSecret: process.env.ARMADA_API_SECRET
});

const { data: wallet } = await armada.wallet.get();
console.log(wallet.balance, wallet.currency);

The SDK adds the authentication headers. For a 401, check the credentials and system clock. See Authentication.

4. Create a test delivery

Create a separate key and keep Test mode on. Keep the permissions below, clear the others and click Save changes:

PermissionUsed for
wallet:readRun the wallet check with this key
branch:readFind your pickup branch
delivery:writeCreate a delivery
delivery:readCheck its status
delivery:cancelCancel it

Set the environment variables to this test key and create the client again using step 3. List pickup branches:

javascript
const { data: branchPage } = await armada.branches.list();
console.table(branchPage.branches.map(({ id, name }) => ({ id, name })));

The response is { branches: [...] }; the first branch ID is branchPage.branches[0].id. Choose the intended pickup branch. The API returns 30 branches per page by default; see the branch reference if it is not on the first page.

Replace YOUR_BRANCH_ID and the sample destination below with your branch and a contact you control. Pickup and drop-off must be different locations.

To check callbacks, set this key's Order update webhook URL, select Canceled and Completed, then click Save changes before creating the delivery.

Use the webhook guide to verify notifications through signed API reads.

javascript
const { data: order } = await armada.deliveries.create({
	reference: 'test-' + Date.now(),
	payment: { amount: 4.5, type: 'paid' },
	origin_format: 'branch_format',
	origin: { branch_id: 'YOUR_BRANCH_ID' },
	destination_format: 'location_format',
	destination: {
		contact_name: 'Test Customer',
		contact_phone: '+96590000000',
		latitude: 29.3759,
		longitude: 47.9774,
		first_line: 'Salmiya, Block 5, Street 3'
	}
});

console.log(order.code, order.status, order.test_mode);

Keep the returned code and confirm test_mode is true. Allow up to 90 seconds for the simulation to complete. See Test mode for the lifecycle stages.

If creation times out, check whether the order was created before sending it again. Reusing reference can create another delivery.

5. Read or cancel the delivery

Add these calls below the create example to read and cancel the same test delivery:

javascript
const { data: current } = await armada.deliveries.get(order.code);
console.log(current.status);

const { data: canceled } = await armada.deliveries.cancel(order.code, 'Integration test');
console.log(canceled.status); // canceled

Cancel while the test delivery is dispatched, accepted or en_route. A completed delivery returns 400; create a fresh test delivery to test again. Repeating cancellation of an already canceled delivery returns its current state.

With Canceled selected in the saved settings, expect topic order.updated with status: "canceled". See Webhooks for receiver setup and delivery behavior.

6. Go live

Create a separate production key, keep only your integration's required permissions and configure its production webhook URLs and statuses. New keys start in Test mode, so turn Test mode off and click Save changes before using this key for customer orders.

Switch your server to the production key and secret. Map its new x-armada-key-id at your receiver. On the first intended live delivery, confirm test_mode: false; changing the key does not convert previously created test orders.

Next: API reference and delivery behavior.