SmartRoutes Notifications API
The Notifications API from SmartRoutes — 2 operation(s) for notifications.
The Notifications API from SmartRoutes — 2 operation(s) for notifications.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/smartroutes-io:smartroutes-io-notifications-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: SmartRoutes Notifications API
description: '# Getting started
## Introduction
The SmartRoutes API gives your software programmatic access to the SmartRoutes platform. You can manage the full delivery lifecycle from your own systems. Push orders and customers in from your ERP, e-commerce or WMS. Keep your fleet, capacities and zones in sync. Run route optimisation and dispatch plans to drivers. Then pull back what happened on the road: order statuses, proof of delivery photos and signatures, and driver questionnaire responses. The API also handles customer notifications and booking availability checks. Webhooks notify your systems in real time when orders change status, plans are dispatched or routes are completed. It''s a REST API over HTTPS that uses JSON and authenticates with an access key, which you generate in SmartRoutes under Settings > Integrations. ## Base URL
Every endpoint path in this reference is relative to this base URL:
https://api.smartroutes.io/v2
So `GET /orders` in this reference means `GET https://api.smartroutes.io/v2/orders`. **The documentation host is not the API host.** These docs are published at `smartroutes.io/api`, which serves this page and the OpenAPI spec only. Requests sent there do not reach the API — send them to the base URL above. ## Authentication
To use the API, you will need to generate an API Access Key for your SmartRoutes account. To generate, login to your SmartRoutes account and navigate to Settings > Integrations > SmartRoutes Open API and click ''Generate API Key''. For more details on SmartRoutes integrations, click here. All requests expect the API Access Key to be provided in the `x-access-key` header:
```http
x-access-key: YOUR_ACCESS_KEY
```
Two optional request headers are also recognised: `x-sr-api-features`, accepted on every endpoint (see API Features), and `idempotency-key`, honoured on the `POST` endpoints listed under Idempotency. Webhook deliveries from SmartRoutes to your receiver are authenticated differently — see Webhooks. ## Rate Limits
Every endpoint has a per-minute limit, and most also have a short burst limit. Requests are rejected as soon as either limit is hit. Most endpoints fall into one of these tiers:
| Tier | Rate limit | Description |
|---|---|---|
| Standard | 60 / min (max 5 / sec) | Single-resource reads and writes (e.g. `GET /orders/{id}`, `PUT /orders/{id}`) |
| Listing | 30 / min (max 5 / sec) | Paginated lists (e.g. `/customers`, `/plans`, `/routes`) |
| Reference | 60 / min (max 1 / sec) | Reference data (e.g. capacities, custom fields, vehicles, zone groups) |
| Bulk | 30 / min (max 1 per 2 sec) | Bulk creates and heavy deletes |
| Upload | 15 / min (max 1 / sec) | File uploads (e.g. `POST /orders/{id}/attachments`) |
The following endpoints have a stricter limit of **5 / min (max 2 per 15 sec)**:
- Plan optimisation: `POST /plans/optimise/orders`, `POST /plans/optimise/orders-for-ids`
- Booking availability: `POST /booking/availability`, `POST /booking/available-dates`, `POST /booking/available-slots`
- Route reversal: `POST /routes/{id}/reverse`
The two dispatch endpoints have the Standard per-minute allowance with a tighter burst, **60 / min (max 2 per 2 sec)**, because each call blocks for the full dispatch (up to two minutes):
- `POST /routes/{id}/dispatch`
- `POST /plans/{id}/dispatch`
When a limit is hit, the API returns HTTP **403** with a `Retry-After` header and `details.retry_after_seconds` in the body — both give the seconds until the limit resets. **Prefer `429`?** `403` is the status this API has always returned for rate limiting, and it stays the default so existing integrations keep working. Send `x-sr-api-features: rate-limit-429` and a tripped limit answers `429 Too Many Requests` with `name: "RATE_LIMIT_EXCEEDED"` instead. Nothing else about the response changes — `Retry-After` and `details.retry_after_seconds` are already sent on the `403`. See API Features. We may temporarily reduce these limits to protect platform stability.'
version: 2.0.0
contact:
name: SmartRoutes Support
email: support@smartroutes.io
url: https://smartroutes.io/support
servers:
- url: https://api.smartroutes.io/v2/
description: API base URL — every path in this reference is relative to it.
tags:
- name: Notifications
paths:
/notifications/templates:
get:
summary: Get Notification Templates
operationId: listNotificationTemplates
description: 'Lists the SMS and email notification templates set up for the depot your API key belongs to. Use it to look up the template `id`s you pass in `templates` to `POST /notifications/schedule/orders`.
The response is a plain JSON array, not wrapped in a key. Each entry has `id`, `type` (`SMS` or `EMAIL`) and `name`. Deleted templates are left out, and the list is returned in full, with no paging. Templates are created and edited in the SmartRoutes web app, not through the API.'
tags:
- Notifications
responses:
'200':
description: Successful response
content:
application/json:
example:
- id: 123
type: EMAIL
name: My Email Template
- id: 124
type: SMS
name: My SMS Template
'403':
$ref: '#/components/responses/Forbidden'
'429':
$ref: '#/components/responses/RateLimited'
'500':
$ref: '#/components/responses/ServerError'
/notifications/schedule/orders:
post:
summary: Schedule Order Notifications
operationId: scheduleOrderNotifications
description: 'Schedules SMS and/or email notifications to the customers on a set of orders, using up to two of your notification templates (see `GET /notifications/templates`). At least one notification is created for each order and template pair: an email template creates one for each email address on the order. It is sent at `send_time_utc`, or straight away if you leave that out.
- The recipient is the order''s contact phone number or email. If the order has none, the linked customer''s phone number or email is used.
- If a notification profile is assigned to the order, its customer or its third party, the notifications are sent from the profile''s sender. The template is always the one you chose.
- Each SMS uses one credit per SMS segment, and the credits are deducted when the notification is scheduled. Long messages, and messages with accented letters such as á or emoji, use more segments.
- An SMS is skipped and listed in `errors` if the depot''s remaining credits don''t cover it. If the depot has no SMS credits left at all, SMS templates are skipped without being reported in `errors`.
- A template with a booking link moves the order to `WAITING_CONFIRMATION`.
- Order and template ids that don''t belong to this depot are ignored. If none of the orders are found, the response is `404 RESOURCE_NOT_FOUND`.
- Nothing checks for duplicates. Calling again for the same orders schedules the notifications again.
The request can partly succeed. The response is `200` with `notifications` listing the `order_id` of each notification created, and `errors` listing each order and template pair that was skipped and why (for example, no phone number, a landline number, or an invalid email). Check `errors` even when the status is 200. To see the scheduled notifications, use `GET /notification-tasks`. Supports the `idempotency-key` header, so a retry won''t schedule twice (see Idempotency). The exception is a `5xx` response: some notifications may already have been scheduled, and a retry with the same key schedules them again. Check `GET /notification-tasks` before retrying a `5xx`.'
tags:
- Notifications
parameters:
- $ref: '#/components/parameters/IdempotencyKeyHeader'
requestBody:
content:
application/json:
schema:
type: object
properties:
orders:
type: array
items:
type: integer
minimum: 1
minItems: 1
maxItems: 1000
description: Array of order IDs to create notifications for. At most 1000.
templates:
type: array
items:
type: integer
minimum: 1
minItems: 1
maxItems: 2
description: Array of template IDs to generate notifications for. At most 2.
send_time_utc:
type: string
pattern: ^\d{4}-\d{2}-\d{2} \d{2}:\d{2}(:\d{2})?$
description: UTC time at which to send the notifications, as `YYYY-MM-DD HH:mm` or `YYYY-MM-DD HH:mm:ss`. Defaults to the current time if not provided.
required:
- orders
- templates
example:
orders:
- 123
- 124
templates:
- 999
send_time_utc: '2024-12-25 12:00:00'
responses:
'200':
description: Successful response
content:
application/json:
example:
notifications:
- order_id: 123
errors:
- name: INVALID_INPUT
description: Couldn't create notification. No phone number provided
statusCode: 400
isOperational: true
sendAlert: false
sourceError: null
details:
id: null
order_id: 124
visit_orders:
- order_id: 124
order_number: ORD124
phone: null
email: johndoe@test.com
country: null
name: John Doe
reference_id: ORD124
visit_custom_fields: []
address: Cork City, Cork
timestamp: '2024-12-30T00:00:00.000Z'
headers:
idempotency-replay:
$ref: '#/components/headers/IdempotencyReplay'
'400':
$ref: '#/components/responses/InvalidInput'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/IdempotencyRequestInProgress'
'422':
$ref: '#/components/responses/IdempotencyKeyReusedWithDifferentBody'
'403':
$ref: '#/components/responses/Forbidden'
'429':
$ref: '#/components/responses/RateLimited'
'500':
$ref: '#/components/responses/ServerError'
components:
responses:
IdempotencyKeyReusedWithDifferentBody:
description: The same idempotency key was used with a different request body for this endpoint.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
key_reused:
summary: Same key, different body
value:
name: IDEMPOTENCY_KEY_REUSED_WITH_DIFFERENT_BODY
statusCode: 422
description: The same idempotency key was used with a different request body for this endpoint.
details: {}
RateLimited:
description: 'Rate limit exceeded (`name = RATE_LIMIT_EXCEEDED`). **Only returned to callers that opt in** with the `x-sr-api-features: rate-limit-429` request header; without it the same condition returns `403` with `name = FORBIDDEN` and an otherwise identical body. See [API Features](#section/Getting-started/API-Features).'
headers:
Retry-After:
schema:
type: integer
description: Seconds to wait before retrying. Same value as `details.retry_after_seconds`.
x-sr-api-features-applied:
$ref: '#/components/headers/ApiFeaturesApplied'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
rate_limit_exceeded:
summary: 'Rate limit reached (with x-sr-api-features: rate-limit-429)'
value:
name: RATE_LIMIT_EXCEEDED
statusCode: 429
description: You've reached your limits for this request.
details:
depot_id: 1234
type: ORDERS_GET
retry_after_seconds: 12
Forbidden:
description: 'Forbidden. Returned for rate-limit exhaustion (`name = FORBIDDEN`, with `details.retry_after_seconds` and `Retry-After` header) and permission gate failures (`name = PERMISSION`). Inspect `name` to disambiguate. Send `x-sr-api-features: rate-limit-429` to receive `429 RATE_LIMIT_EXCEEDED` for the rate-limit case instead, leaving `403` to mean permission failures only — see [API Features](#section/Getting-started/API-Features).'
headers:
Retry-After:
schema:
type: integer
description: Seconds to wait before retrying. Present only when the cause is rate-limit exhaustion.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
rate_limited:
summary: Rate limit reached (legacy default)
value:
name: FORBIDDEN
statusCode: 403
description: You've reached your limits for this request.
details:
depot_id: 1234
type: ORDERS_GET
retry_after_seconds: 12
permission:
summary: Not permitted for your depot (e.g. POST /orders without a customer)
value:
name: PERMISSION
statusCode: 403
description: This depot does not allow orders without a customer. Each affected order must include a `customer` object with either `customer.id` (numeric, from the customers endpoint) or `customer.account` (the unique account string).
details:
order_numbers:
- ABC123
remediation: 'Add a `customer` field to each listed order — `{customer: {id: <int>}}` or `{customer: {account: ''<account_string>''}}`. Look up existing customers via GET /v2/customers (REST) or `list_customers` (MCP) before creating a new one.'
NotFound:
description: The requested resource was not found.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
not_found:
summary: A resource that does not exist in your depot
value:
name: RESOURCE_NOT_FOUND
statusCode: 404
description: 'Order not found for id: 12345'
details: {}
ServerError:
description: 'An unexpected server error occurred. The body carries only `name` and `description`: internal details are never returned.'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
server_error:
summary: An unexpected server error
value:
name: INTERNAL_SERVER_ERROR
description: Something went wrong. Please try again later.
InvalidInput:
description: Invalid input. The request body failed validation.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
invalid_input:
$ref: '#/components/examples/ErrorResponse'
IdempotencyRequestInProgress:
description: A request with this idempotency key is already in progress. Retry after the period given in the `Retry-After` header.
headers:
Retry-After:
schema:
type: integer
description: Seconds to wait before retrying.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
in_progress:
summary: The first request with this key is still running
value:
name: IDEMPOTENCY_REQUEST_IN_PROGRESS
statusCode: 409
description: A request with this idempotency key is already in progress. Retry after the period given in Retry-After.
details:
retry_after_seconds: 2
schemas:
ErrorResponse:
type: object
description: Standard error envelope. Returned for any non-2xx response (with the exception of legacy endpoints not yet migrated). The shape is flat — no enclosing `error` wrapper.
required:
- name
- statusCode
- description
- details
properties:
name:
type: string
description: Machine-readable error name. Stable string identifier; safe to switch on programmatically.
enum:
- INVALID_INPUT
- RESOURCE_NOT_FOUND
- UNAUTHORIZED
- FORBIDDEN
- PERMISSION
- RATE_LIMIT_EXCEEDED
- GONE
- ALREADY_DISPATCHED
- SERVICE_UNAVAILABLE
- INTERNAL_SERVER_ERROR
- INTERNAL_RESOURCE_MISSING
- ERROR_WARNING
- LATENCY_WARNING
- VALIDATION_REQUEST
- GEOCODING_FAILED
- INVALID_EMAIL_DROPPED
- REDIS_UNAVAILABLE
- SEND_ERROR
- IDEMPOTENCY_KEY_REUSED_WITH_DIFFERENT_BODY
- IDEMPOTENCY_REQUEST_IN_PROGRESS
- IDEMPOTENCY_INVALID_KEY
statusCode:
type: integer
description: HTTP status code matching the response status. Legacy camelCase property name; kept for backwards compatibility.
description:
type: string
description: Human-readable description of the error. For developers; not intended for end-user display.
details:
type: object
additionalProperties: true
description: Additional structured details about the error. Always an object — never null. May be empty (`{}`). Validation errors populate this with a `validationErrors` array of Zod issues.
parameters:
IdempotencyKeyHeader:
name: idempotency-key
in: header
required: false
description: Optional idempotency key for safe retries. See [Idempotency](#section/Getting-started/Idempotency) for behaviour. 1–255 characters; UUID recommended.
schema:
type: string
minLength: 1
maxLength: 255
headers:
ApiFeaturesApplied:
description: Echoes the opt-in API feature tokens the server recognised and applied to this request, comma-separated and sorted. Absent when none were applied. Unrecognised tokens are ignored rather than rejected, so this header is how a client confirms an opt-in took effect.
schema:
type: string
IdempotencyReplay:
description: Set to `true` when the response is a cached replay of an earlier request with the same `idempotency-key`. Absent otherwise.
schema:
type: string
enum:
- 'true'
examples:
ErrorResponse:
summary: A request body that failed validation
value:
name: INVALID_INPUT
statusCode: 400
description: Customers Validation Error
details:
validationErrors:
- code: invalid_type
expected: string
received: undefined
path:
- 0
- account
message: Required