⚡
TRAQ

TRAQ

Overview

TRAQ External Client Integration API allows third-party applications, ecommerce platforms, and external business systems to connect directly with the TRAQ delivery platform.

Using secure API authentication, external systems can automatically:

  • Create customers
  • Create delivery orders
  • Sync delivery information
  • Receive real-time webhook updates
  • Track order delivery status
  • Automate delivery workflows

This integration system is mainly designed for ecommerce platforms, POS systems, logistics partners, and external software providers who need delivery management integration with TRAQ.

The API supports secure backend communication using Bearer Token authentication and JSON-based request/response handling.

Workflow

Think in two layers: first save your integration token in TRAQ so your server is allowed to call the API; then create data in a fixed order — driver, customer, order.

Step 1: Save your integration token

  1. Admin: Settings → Driver → “External client API (integration)”.
  2. Paste a long random value in Integration API token, save. Your backend must send that same value as Authorization: Bearer on every REST or GraphQL call.
  3. Optional: set order-completed webhook URL and signing secret in the same block for delivery callbacks.
If the token is empty, TRAQ returns HTTP 503 for integration calls until you save one.

Step 2: Create driver, customer, then order

Use the same sequence whether you call REST or GraphQL:

Diagram reads left to right (technical flow stays LTR even on RTL pages).

Token in admin
Create driver
Create customer
Create order
  1. Driver — open Create driver when you need a driver user id to assign from your system.
  2. Customer — open Create customer to register the buyer and keep the returned customer id.
  3. Order — open Create order with items and delivery address (pass driver id only if you already created one).

If drivers are created only inside TRAQ by staff, you may skip the driver API step and start with customer.

Authentication

Send the token on every request.

MethodHeader
BearerAuthorization: Bearer <token>

401 — wrong or missing token. 503 — token not configured in settings.

Headers
Authorization: Bearer YOUR_INTEGRATION_TOKEN
Accept: application/json
Content-Type: application/json

GraphQL API

One URL for all integration mutations. Send JSON with query and optional variables. Same Bearer token as REST.

POST https://gotraq.com/api/v1/driver/integration/graphql

Supported operations

  • query { ping } — health check
  • createCustomer — CreateCustomerInput
  • createOrder — CreateOrderInput (uses address, product qty)
  • createDriver — CreateDriverInput

GraphQL may return HTTP 200 with errors in the body; always check the payload.

cURL (ping)
curl -sS -X POST "https://gotraq.com/api/v1/driver/integration/graphql" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"query":"query { ping }"}'

Example mutation bodies (JSON POST)

createCustomer
{
  "query": "mutation CreateCustomer($input: CreateCustomerInput!) { createCustomer(input: $input) { success message data { id name email phone default_address { id address_name block } } } }",
  "variables": {
    "input": {
      "name": "Partner User",
      "email": "[email protected]",
      "phone": "+96550000000",
      "customer_address": {
        "name": "Partner User",
        "phone": "+96550000000",
        "email": "[email protected]",
        "country": "KW",
        "state": "Area",
        "city": "City",
        "block": "1",
        "street": "Example Street"
      }
    }
  }
}
createOrder
{
  "query": "mutation CreateOrder($input: CreateOrderInput!) { createOrder(input: $input) { success message data { id status amount } } }",
  "variables": {
    "input": {
      "customer_id": "1",
      "external_reference": "SHOP-ORDER-1001",
      "driver_id": "2",
      "products": [{ "id": "1", "qty": 1 }],
      "address": {
        "name": "Recipient",
        "phone": "+96550000000",
        "email": "[email protected]",
        "country": "KW",
        "state": "Area",
        "city": "City",
        "address": "Block 1, Street 2, Building 3"
      }
    }
  }
}
createDriver
{
  "query": "mutation CreateDriver($input: CreateDriverInput!) { createDriver(input: $input) { success message data { id first_name last_name email phone client_driver_id civil_id license_no driver_type } } }",
  "variables": {
    "input": {
      "first_name": "API",
      "last_name": "Driver",
      "email": "[email protected]",
      "phone": "+96550000001",
      "password": "change-me-in-production",
      "civil_id": "CIV-123456",
      "license_no": "LIC-12345",
      "driver_type": "full_time",
      "client_driver_id": "EXT-DRV-001"
    }
  }
}

Browser GraphQL tester

Send test requests

Pick a tab, edit the JSON body if needed, then send. Every request is an HTTP POST to the GraphQL URL below with Content-Type: application/json. Use the same integration token as REST.

Request URL (POST)

POST https://gotraq.com/api/v1/driver/integration/graphql

Headers (template matches the active tab)

Header template
Authorization: Bearer YOUR_INTEGRATION_SECRET
Accept: application/json
Content-Type: application/json

Use the same token you saved in TRAQ admin. Send adds Authorization and your token for you.

Create customer

POST /api/v1/traq/integration/customers

Request body

FieldReqNotes
nameYesstring, max 255
emailYesvalid email, unique
phoneNostore phone rules
passwordNomin 6; random if omitted
dobNodate
customer_addressNoobject; when present, saves one default address on ec_customer_addresses. Omit entirely if you only need the customer record.
customer_address.nameYes*string, max 255 — *required when customer_address is sent
customer_address.phoneYes*string, max 255
customer_address.emailNoemail, max 255; defaults from top-level email if omitted
customer_address.latitudeNonumeric −90…90 (optional; not stored on all DB variants)
customer_address.longitudeNonumeric −180…180
customer_address.country / state / cityNostring, max 255
customer_address.block / street / avenueNostring, max 255
customer_address.house_no / building_no / floor / apartment_noNostring, max 255
customer_address.directionNostring, max 2000
customer_address.paci_numberNostring, max 255
customer_address.address_typeNohouse, office, or apartment (default house)
customer_address.office_no / office_name / building_nameNostring
cURL
curl -sS -X POST "https://gotraq.com/api/v1/traq/integration/customers" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"name":"API doc test user","email":"[email protected]","phone":"+96550000000","customer_address":{"name":"API doc test user","email":"[email protected]","phone":"+96550000000","latitude":29.3759,"longitude":47.9774,"country":"KW","state":"State","city":"City","block":"1","street":"Test Street","avenue":"Avenue 12","house_no":"15","building_no":"B-7","floor":"3","apartment_no":"12","direction":"Ring bell twice; delivery dock at rear.","paci_number":"PACI-00000000","address_type":"apartment"}}'

Create order

POST /api/v1/traq/integration/orders

Request body

FieldReqNotes
external_referenceNostring, max 255 — used for webhook correlation
driver_idNoexisting driver user id; auto-assigns the order
productsYesarray, min 1 item
products.*.idNointernal product id (or omit and pass sku)
products.*.skuNostring, max 255 — resolved to product id when id is missing
products.*.nameNostring, max 255
products.*.quantityYesinteger, min 1
products.*.priceNonumeric, min 0
products.*.weightNonumeric, min 0
customer_addressYesobject
customer_address.nameYesstring, max 255
customer_address.phoneYesstring, max 255
customer_address.emailNovalid email, max 255
customer_address.latitudeYesnumeric, between -90 and 90
customer_address.longitudeYesnumeric, between -180 and 180
customer_address.country / state / cityNostring, max 255
customer_address.block / street / avenueNostring, max 255
customer_address.house_no / building_no / floor / apartment_noNostring, max 255
customer_address.directionNostring, max 2000
customer_address.paci_numberNostring, max 255
sub_total / tax_amount / shipping_amount / discount_amount / amountNonumeric, min 0 (computed if omitted)
serial_numberNostring — attached to the first order line
cURL
curl -sS -X POST "https://gotraq.com/api/v1/traq/integration/orders" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "customer_id": 1,
    "external_reference": "PART-101",
    "products": [{"id": 10, "quantity": 1, "price": 0}],
    "customer_address": {
      "name": "Test User",
      "email": "[email protected]",
      "phone": "+96550000000",
      "latitude": 29.3759, "longitude": 47.9774,
      "country": "KW", "state": "State", "city": "City",
      "block": "1", "street": "Main"
    }
  }'

Response models

422 — business / duplicate (example)
{
  "success": false,
  "message": "Product is out of stock!"
}

Create driver

POST /api/v1/traq/integration/drivers

Request body

FieldReqNotes
first_nameYesstring, max 255
last_nameYesstring, max 255
emailYesvalid email, unique in users.email
phoneYesunique in users.phone; obeys platform phone rules
passwordYesstring, min 6
civil_idYesstring, max 100, unique in am_drivers_profiles.civilian_id
license_noYesstring, max 255
driver_typeYesone of full_time, part_time, contract
client_driver_idNostring, max 255 — your external driver reference
shifts[]Noarray of { shift_start, shift_end } (strings, max 32)
duty_shift / duty_start_time / duty_end_timeNostring
cURL
curl -sS -X POST "https://gotraq.com/api/v1/traq/integration/drivers" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "first_name": "John",
    "last_name": "Driver",
    "email": "[email protected]",
    "phone": "+96550000001",
    "password": "secret123",
    "civil_id": "CIV-123456",
    "license_no": "LIC-7788",
    "driver_type": "full_time",
    "client_driver_id": "EXT-DRV-001"
  }'

Browser API tester

Send test requests

Pick a tab to try creating a customer, driver, or order, or to load your drivers. Calls go from your browser to the address below (usually this TRAQ site). For the first three tabs, edit the sample JSON if needed, then click send. For drivers, you can add optional filters, then send.

Full request address (changes when you change tab)

POST https://gotraq.com/api/v1/traq/integration/customers

Headers (template matches the active tab)

Header template
Authorization: Bearer YOUR_INTEGRATION_SECRET
Accept: application/json
Content-Type: application/json

Use the same token you saved in TRAQ admin. Send adds Authorization and your token for you. The drivers tab loads data without a JSON body, so the sample headers do not include Content-Type.

Loads your driver list from TRAQ (the address above updates when you open this tab). Optional: add filters after the address, for example ?search=john or ?status=active.

Webhook

POST Your configured webhook URL

When an order reaches completed, we POST JSON to your URL.

Headers

Content-Typeapplication/json
X-Driver-Webhook-IdUUID
X-Driver-Webhook-SignatureHMAC-SHA256 (hex) of raw body
JSON body
{
  "event": "order.completed",
  "order": {
    "id": 1,
    "code": "ORD-1",
    "status": "completed",
    "external_reference": null
  },
  "customer": { "id": 1, "name": "Name" },
  "products": [{ "product_id": 10, "qty": 1 }]
}

Errors

HTTP StatusTypical Cause
401Invalid or missing integration token
422Validation or order error (email, stock, address, …)
503Token not set; ecommerce off; no admin user