e Ecovoy Developers
ecovoy.com Log in

API reference

All endpoints of Ecovoy API V2. Base URL:

https://api.ecovoy.com/api/v2

Conventions


POST /oauth/token

Exchanges client_id + client_secret for an access token. Full details in Authentication.


GET /me

Returns the application, environment and scopes of the current token. Scope: account:read.

curl https://api.ecovoy.com/api/v2/me -H "Authorization: Bearer $TOKEN"
Response · 200
{
  "data": {
    "application": {
      "id": "9b4e6a2e-3f0e-4d55-9a62-8f3c1d2b7a10",
      "name": "My Store",
      "status": "active",
      "production_access": "not_requested"
    },
    "environment": "sandbox",
    "scopes": ["account:read", "balance:read", "transactions:read", "topup:read", "topup:write"],
    "token_expires_at": "2026-11-10T15:00:00+00:00",
    "account": { "name": "Jane Doe" }
  }
}

GET /balance

Available balance. Scope: balance:read.

curl https://api.ecovoy.com/api/v2/balance -H "Authorization: Bearer $TOKEN"
Response · 200
{
  "data": {
    "available": 1000.00,
    "currency": "USD",
    "environment": "sandbox",
    "simulated": true
  }
}

GET /transactions

Paginated list, newest first. Scope: transactions:read.

Query parameterDefaultDescription
page1Page number.
per_page20Items per page, 1–100.
curl "https://api.ecovoy.com/api/v2/transactions?per_page=20&page=1" -H "Authorization: Bearer $TOKEN"
Response · 200 (sandbox, shortened)
{
  "data": [
    {
      "transaction_id": "sbx_01jcz5k8v3m2q9w7e4r6t1y0ab",
      "external_id": "ext_01jcz5k8v3m2q9w7e4r6t1y0ac",
      "mobile_number": "+50944101111",
      "status": "CONFIRMED",
      "retail_amount": 2,
      "retail_unit": "USD",
      "formatted_amount": "2 USD",
      "operator_name": "Sandbox Mobile Operator 2",
      "product_id": "sbx-product-002",
      "product_name": "200 TEST",
      "external_ref_id": "ORDER-2026-000123",
      "external_customer_id": "CUSTOMER-001",
      "environment": "sandbox",
      "created_at": "2026-11-13T14:05:12.000000Z",
      "...": "same fields as the order response"
    }
  ],
  "meta": { "current_page": 1, "per_page": 20, "total": 1, "last_page": 1 }
}

GET /transactions/{transaction_id}

One transaction, by the transaction_id returned by /mobile-recharge/orders. Scope: transactions:read. Use it to follow an order until it reaches a final status (see Transaction statuses). Returns 404 NOT_FOUND if the transaction does not belong to your application (sandbox) or account (production).


Mobile recharge flow

A mobile recharge has four separate steps. Only the confirmation executes the recharge and debits the balance.

StepEndpointWhat it doesCreates a transaction?
1. Automatic identificationPOST /mobile-recharge/lookupEcovoy identifies the operator of the number and lists its products.No
2. Manual operator selection (optional)POST /mobile-recharge/operator-switchLists the products of another operator chosen by your customer.No
3. Order creationPOST /mobile-recharge/ordersRegisters the order with your external_ref_id and returns the Ecovoy transaction_id. Does not execute the recharge.Yes
4. ExecutionPOST /mobile-recharge/confirmExecutes the recharge for an existing transaction_id.No (uses the existing one)
— or cancellationPOST /cancel-transactionCancels the order instead of confirming it. Only before /confirm.No (uses the existing one)
  1. Look up the number with /lookup.
  2. If the customer says the operator is wrong (for example, a ported number), call /operator-switch with the operator they chose.
  3. Create the order with /orders, using a product_id from the last response of step 1 or 2, the external_ref_id of the sale in your system, and a new Idempotency-Key.
  4. Store the transaction_id returned by Ecovoy next to your external_ref_id.
  5. Request the execution with /confirm and that transaction_id.
  6. Follow the result with GET /transactions/{transaction_id} until the status is final.

A complete script is available in Code examples.

Identifiers

FieldWho sets itUse
transaction_idEcovoyUnique id of the transaction on the Ecovoy platform. Returned by /orders. It is the id accepted by /confirm, /cancel-transaction and /transactions/{id}. Store it.
external_ref_idYou (required)Reference of the transaction in your system (your order, sale or invoice number). One per transaction: it cannot be reused by another order. Stored with the order and returned in every response, so you can match each Ecovoy transaction to your own record. It does not replace transaction_id: /confirm, /cancel-transaction and /transactions/{id} accept only the transaction_id.
external_customer_idYou (optional)Id of the end customer in your system. Several orders can have the same value. Stored with the order and returned in the responses. Not used to find or confirm the transaction.
external_id (response only)EcovoyInternal Ecovoy reference used with the recharge network. You cannot set it. Do not use it to confirm or look up a transaction; use transaction_id.
Idempotency-Key (header)You (required)Protects order creation against duplicates on retries. See Idempotency. It is not a transaction id.

Transaction statuses

The status field of a transaction. Treat unknown values as "not final" and keep polling.

statusMeaningFinal?
PENDINGOrder created, waiting for /confirm, or recharge being processed.No
CONFIRMED, COMPLETEDRecharge executed successfully.Yes — success
DECLINED (Production), FAILED (Sandbox)Recharge rejected. In the sandbox, failure_reason explains why.Yes — failure
CANCELLEDOrder cancelled with /cancel-transaction, or expired without confirmation.Yes

Idempotency

POST /mobile-recharge/orders requires the header Idempotency-Key (any string up to 100 characters; a UUID is recommended). Without it the API returns 400 IDEMPOTENCY_KEY_REQUIRED.

The body is compared on mobile_number, product_id, external_ref_id and external_customer_id. Keys are scoped to your application.

The external_ref_id adds a second protection, in both environments: an order with an external_ref_id that already exists is refused with 409 DUPLICATE_EXTERNAL_REF_ID, and error.details.transaction_id tells you which order already uses it.

Production — current limitation. In Production the Idempotency-Key header is required and validated, but replay (Idempotent-Replayed) and IDEMPOTENCY_CONFLICT are not available yet. A retry with the same body is answered with 409 DUPLICATE_EXTERNAL_REF_ID instead: read error.details.transaction_id to recover the order created by the first request, and continue with that transaction_id. No duplicate order is created.

Same key + same body · 200 (sandbox)
HTTP/1.1 200 OK
Content-Type: application/json
Idempotent-Replayed: true

{
  "data": {
    "transaction_id": "sbx_01jcz5k8v3m2q9w7e4r6t1y0ab",
    "status": "PENDING",
    "...": "the original order, unchanged"
  }
}
Same key + different body · 409 (sandbox)
HTTP/1.1 409 Conflict
Content-Type: application/json

{
  "success": false,
  "error": {
    "code": "IDEMPOTENCY_CONFLICT",
    "message": "This Idempotency-Key was already used with a different request body.",
    "request_id": "req_1a2b3c4d5e6f4a7b8c9d0e1f2a3b4c5d"
  }
}
external_ref_id already used · 409 (sandbox and production)
HTTP/1.1 409 Conflict
Content-Type: application/json

{
  "success": false,
  "error": {
    "code": "DUPLICATE_EXTERNAL_REF_ID",
    "message": "This external_ref_id was already used by another order. Send a new external_ref_id for each order.",
    "details": { "transaction_id": "sbx_01jcz5k8v3m2q9w7e4r6t1y0ab" },
    "request_id": "req_2b3c4d5e6f7a4b8c9d0e1f2a3b4c5d6e"
  }
}

POST /mobile-recharge/lookup

Automatic identification. Ecovoy identifies the operator of a mobile number and returns the products of that operator. Read-only. Scope: topup:read.

FieldTypeDescription
mobile_number requiredstringInternational format: + followed by 8–15 digits, e.g. +50944103000.

Response

curl -X POST https://api.ecovoy.com/api/v2/mobile-recharge/lookup \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"mobile_number": "+50944103000"}'
Response · 200 (sandbox, shortened)
{
  "data": {
    "mobile_number": "+50944103000",
    "operators": [
      {
        "id": "sbx-ht-001",
        "name": "Sandbox Mobile Operator 1",
        "identified": true,
        "logo_url": null,
        "logo_url_subservice": null,
        "country_name": "Haiti",
        "country_iso": "HTI",
        "country_flag_url": "https://ecovoy.com/assets/flags/4x3/ht.svg"
      },
      {
        "id": "sbx-ht-002",
        "name": "Sandbox Mobile Operator 2",
        "identified": false,
        "logo_url": null,
        "logo_url_subservice": null,
        "country_name": "Haiti",
        "country_iso": "HTI",
        "country_flag_url": "https://ecovoy.com/assets/flags/4x3/ht.svg"
      }
    ],
    "products": [
      {
        "id": "sbx-product-001",
        "name": "100 TEST",
        "display_price": "1 USD",
        "display_destination_amount": "100 TEST",
        "price_retail_amount": 1,
        "price_retail_unit": "USD",
        "price_wholesale_amount": 0.9,
        "price_wholesale_unit": "USD",
        "service_name": "Mobile",
        "subservice_name": "Airtime",
        "promotions": [],
        "operator": { "id": "sbx-ht-001", "name": "Sandbox Mobile Operator 1", "country_name": "Haiti", "country_iso": "HTI" }
      },
      { "id": "sbx-product-003", "name": "500 TEST", "display_price": "5 USD", "...": "..." },
      { "id": "sbx-product-005", "name": "1000 TEST", "display_price": "10 USD", "...": "..." }
    ],
    "environment": "sandbox"
  }
}

Errors: 404 OPERATOR_NOT_FOUND (no operator for the number), 422 VALIDATION_ERROR, 502 PROVIDER_ERROR (Production, upstream failure — retry later).


POST /mobile-recharge/operator-switch

Manual operator selection. Use it when the operator identified automatically by /lookup is not the real operator of the number — for example, the customer ported the number to another operator. It returns only the products of the operator you send. Read-only. Scope: topup:read.

FieldTypeDescription
mobile_number requiredstringInternational format, e.g. +50944103000.
operator_id requiredstring ≤ 50The operator chosen by the customer: an operators[].id from /lookup.
country_iso_code requiredstring, 2–3 lettersThe country of that operator. Send the operators[].country_iso value returned by /lookup for the same operator (e.g. HTI).
Request body
{
    "mobile_number": "+50944103000",
    "operator_id": "sbx-ht-002",
    "country_iso_code": "HTI"
}
curl -X POST https://api.ecovoy.com/api/v2/mobile-recharge/operator-switch \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"mobile_number": "+50944103000", "operator_id": "sbx-ht-002", "country_iso_code": "HTI"}'
Response · 200 (sandbox, shortened)
{
  "data": {
    "mobile_number": "+50944103000",
    "operators": [
      { "id": "sbx-ht-002", "name": "Sandbox Mobile Operator 2", "country_iso": "HTI", "...": "..." },
      { "id": "sbx-ht-001", "name": "Sandbox Mobile Operator 1", "country_iso": "HTI", "...": "..." }
    ],
    "products": [
      {
        "id": "sbx-product-002",
        "name": "200 TEST",
        "display_price": "2 USD",
        "display_destination_amount": "200 TEST",
        "price_retail_amount": 2,
        "price_retail_unit": "USD",
        "price_wholesale_amount": 1.8,
        "price_wholesale_unit": "USD",
        "service_name": "Mobile",
        "subservice_name": "Airtime",
        "promotions": [],
        "operator": { "id": "sbx-ht-002", "name": "Sandbox Mobile Operator 2", "country_name": "Haiti", "country_iso": "HTI" }
      },
      { "id": "sbx-product-004", "name": "1000 TEST", "display_price": "10 USD", "...": "..." },
      { "id": "sbx-product-006", "name": "2000 TEST", "display_price": "20 USD", "...": "..." }
    ],
    "environment": "sandbox"
  }
}

Errors: 404 OPERATOR_NOT_FOUND, 422 VALIDATION_ERROR (missing or invalid field; see details), 403 INSUFFICIENT_SCOPE (token without topup:read), 502 PROVIDER_ERROR (Production).


POST /mobile-recharge/orders

Order creation. Registers a recharge order and returns the transaction_id generated by Ecovoy. It does not execute the recharge and does not debit the balance: to execute it, call /mobile-recharge/confirm. Scope: topup:write.

Field / headerTypeDescription
Idempotency-Key header requiredstring ≤ 100A new unique value for each order. See Idempotency.
mobile_number requiredstringInternational format, e.g. +50944101111.
product_id requiredstring ≤ 50A products[].id from the last /lookup or /operator-switch response for this number.
external_ref_id requiredstring ≤ 100Reference of this transaction in your system, e.g. your order number ORDER-2026-000123. Must be different for each order (unique per application in the sandbox, per Ecovoy account in Production).
external_customer_idstring ≤ 100Optional. Id of the end customer in your system.

Other body fields are ignored.

One external_ref_id per transaction

Send, in external_ref_id, the id that your system already uses for the sale — the order, cart or invoice number. Each order sent to Ecovoy has its own external_ref_id:

Example: matching your orders to Ecovoy transactions
Your system                        Ecovoy API
-------------------------------    -------------------------------------------------
Order #123 (customer pays $2)  ->  POST /orders  external_ref_id: "ORDER-2026-000123"
                                   <- transaction_id: "sbx_01jcz5k8v3m2q9w7e4r6t1y0ab"
Order #124 (same customer)     ->  POST /orders  external_ref_id: "ORDER-2026-000124"
                                   <- transaction_id: "sbx_01jcz6a1b2c3d4e5f6g7h8j9kk"
Retry of order #124 (timeout)  ->  POST /orders  external_ref_id: "ORDER-2026-000124"
                                   (same Idempotency-Key and body)
                                   <- same transaction_id, no new order

Save both ids together:   ORDER-2026-000123  <->  sbx_01jcz5k8v3m2q9w7e4r6t1y0ab

Result of the order

Sandbox number ends withstatus returned by /ordersNext step
1111PENDINGCall /confirm (→ CONFIRMED) or, instead, /cancel-transaction (→ CANCELLED). Same behaviour as Production.
0000FAILED, with failure_reasonNone. Test your failure handling.
anything elseCOMPLETEDNone: the simulated recharge is already final, and /confirm returns 409 TRANSACTION_NOT_PENDING.
curl -X POST https://api.ecovoy.com/api/v2/mobile-recharge/orders \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 3f6c1e9a-7b2d-4c8e-9a51-0d2f4b6e8c10" \
  -d '{"mobile_number": "+50944101111", "product_id": "sbx-product-002", "external_ref_id": "ORDER-2026-000123", "external_customer_id": "CUSTOMER-001"}'
Response · 201 Created (sandbox, number ending in 1111)
HTTP/1.1 201 Created
Content-Type: application/json
X-Request-Id: req_7d2c4e1a9b3f4e6d8a0c2b4d6f8e0a1c

{
  "data": {
    "transaction_id": "sbx_01jcz5k8v3m2q9w7e4r6t1y0ab",
    "external_id": "ext_01jcz5k8v3m2q9w7e4r6t1y0ac",
    "mobile_number": "+50944101111",
    "status": "PENDING",
    "retail_amount": 2,
    "retail_unit": "USD",
    "formatted_amount": "2 USD",
    "service_name": "Mobile",
    "subservice_name": "Airtime",
    "operator_name": "Sandbox Mobile Operator 2",
    "operator_country": "Haiti",
    "product_id": "sbx-product-002",
    "product_name": "200 TEST",
    "product_type": "FIXED_VALUE_RECHARGE",
    "external_ref_id": "ORDER-2026-000123",
    "external_customer_id": "CUSTOMER-001",
    "environment": "sandbox",
    "benefits": [
      {
        "additional_information": null,
        "amount": { "base": 200, "promotion_bonus": 0, "total_excluding_tax": 200, "total_including_tax": 200 },
        "type": "CREDITS",
        "unit": "TEST",
        "unit_type": "CURRENCY"
      }
    ],
    "promotions": [],
    "can_retry": false,
    "is_reverted": false,
    "account_topup_reference": null,
    "payment_reference": null,
    "receipt_number": null,
    "invoice_number": null,
    "payment_method": null,
    "created_at": "2026-11-13T14:05:12.000000Z",
    "confirmation_expiration_date": null,
    "creation_date": "2026-11-13T14:05:12.000000Z",
    "confirmation_date": null,
    "failure_reason": null
  }
}

In Production the response is 200 and adds "success": true next to data. The data has the same fields (plus mobileNumber, a legacy copy of mobile_number), with "environment": "production" and a filled confirmation_expiration_date:

Response · 200 (production, shortened, illustrative values)
HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": {
    "transaction_id": "48213097561",
    "external_id": "TOPUP-6734a1f2c9e0b",
    "mobileNumber": "+50944103000",
    "mobile_number": "+50944103000",
    "status": "PENDING",
    "retail_amount": 2,
    "retail_unit": "USD",
    "formatted_amount": "2 USD",
    "operator_name": "…",
    "product_id": "…",
    "product_name": "…",
    "external_ref_id": "ORDER-2026-000123",
    "external_customer_id": "CUSTOMER-001",
    "environment": "production",
    "created_at": "2026-11-13T14:05:12.000000Z",
    "confirmation_expiration_date": "2026-11-13T14:20:12.000000Z",
    "confirmation_date": null,
    "...": "same fields as the sandbox response"
  },
  "success": true
}

Errors

HTTPcodeWhen
400IDEMPOTENCY_KEY_REQUIREDIdempotency-Key missing or longer than 100 characters.
409IDEMPOTENCY_CONFLICTSandbox: key already used with a different body.
409DUPLICATE_EXTERNAL_REF_IDThe external_ref_id is already used by another order. details.transaction_id is that order.
422VALIDATION_ERRORInvalid mobile_number, missing product_id or external_ref_id, etc. See details.
422PRODUCT_NOT_FOUNDSandbox: product_id is not a product for this number.
403 / 404 / 409 / 422 / 500TOPUP_FAILEDProduction: the order was refused (product not found, transaction limit reached, invalid data…). Read error.message.
500INTERNAL_ERRORProduction: unexpected error. Retry with the same Idempotency-Key and body.
Missing header · 400
HTTP/1.1 400 Bad Request
Content-Type: application/json

{
  "success": false,
  "error": {
    "code": "IDEMPOTENCY_KEY_REQUIRED",
    "message": "A valid Idempotency-Key header (max 100 chars) is required.",
    "request_id": "req_0f1e2d3c4b5a4968a7b6c5d4e3f2a1b0"
  }
}

POST /mobile-recharge/confirm

Execution. Executes the recharge of an order created by /orders. Send the transaction_id returned by Ecovoy. Scope: topup:write.

FieldEnvironmentDescription
transaction_id requiredSandbox and ProductionThe transaction_id returned by /orders.
amount requiredProductionThe retail_amount returned by /orders.
converted_retail_amount requiredProductionThe retail_amount returned by /orders. A different value is rejected.
converted_currency requiredProductionThe retail_unit returned by /orders (your wallet currency, 3 letters).

Sandbox

Production

# Sandbox
curl -X POST https://api.ecovoy.com/api/v2/mobile-recharge/confirm \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"transaction_id": "sbx_01jcz5k8v3m2q9w7e4r6t1y0ab"}'

# Production: also send the amount and currency returned by /orders
curl -X POST https://api.ecovoy.com/api/v2/mobile-recharge/confirm \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"transaction_id": "48213097561", "amount": 2, "converted_retail_amount": 2, "converted_currency": "USD"}'
Response · 200 (sandbox, shortened)
HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": {
    "transaction_id": "sbx_01jcz5k8v3m2q9w7e4r6t1y0ab",
    "status": "CONFIRMED",
    "mobile_number": "+50944101111",
    "product_id": "sbx-product-002",
    "environment": "sandbox",
    "...": "same fields as the order response"
  }
}
Second confirmation of the same transaction · 409 (sandbox)
HTTP/1.1 409 Conflict
Content-Type: application/json

{
  "success": false,
  "error": {
    "code": "TRANSACTION_NOT_PENDING",
    "message": "Only pending transactions can be confirmed or cancelled.",
    "details": { "status": "CONFIRMED" },
    "request_id": "req_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b"
  }
}

POST /cancel-transaction

Cancellation. Cancels an order created by /mobile-recharge/orders that has not been sent to /mobile-recharge/confirm. The order becomes CANCELLED and can no longer be confirmed. Nothing is charged. Scope: topup:write. Available in Sandbox and Production.

FieldTypeDescription
transaction_id requiredstringThe transaction_id returned by /orders.
Request body
{
    "transaction_id": "sbx_01jcz5k8v3m2q9w7e4r6t1y0ab"
}
Response · 200 (shortened)
{
  "data": {
    "transaction_id": "sbx_01jcz5k8v3m2q9w7e4r6t1y0ab",
    "status": "CANCELLED",
    "...": "same fields as the order response"
  }
}

Errors

HTTPcodeWhen
404NOT_FOUNDThe transaction does not exist, does not belong to your application (sandbox) or account (production), or was already cancelled (production).
409CONFIRMATION_ALREADY_REQUESTEDProduction: /confirm was already called for this order.
409TRANSACTION_NOT_PENDINGThe order is not PENDING (already confirmed, completed, failed or cancelled). details.status has the current status. In the sandbox this is also the answer after a confirmation.
422VALIDATION_ERRORtransaction_id missing.

In the sandbox, use a number ending in 1111 to create a pending order you can cancel.