v2

Send the full list of your numbers

POSThttps://{ourserver.com}/api/resellers/sendNumbersOnline

Pass all numbers that are available for sale right now. The request replaces your list of numbers added through this API:

  • numbers that are not in the request are removed (their value in ids is null);
  • numbers that are already on the list stay as they are, with the same ID (their other fields are not updated: use addNumber to replace a number);
  • new numbers are added and activated by the server within about a minute.

A number without its country code at the beginning gets the code from country_id prepended.

The request also confirms that your server is up. Send it after every change of the list and at least every 5 minutes. Instead of resending the list, you can confirm uptime with checkWork and change the list with addNumber and removeNumber.

If your server has not confirmed uptime for more than 10 minutes, all numbers you added through this API are removed.

Parameters

header1
NameTypeDescription
Authorization*string

see more here

Request Body

Content-Typeapplication/json
Schema
schemaobject
numbersobject[]All numbers available for sale. A JSON string of the array is accepted too.
teststring
Test mode, for /api/resellers* requests only. It can be passed in the query string or in the request body.
  • test1 — the request is executed and answered as usual, but its database changes are rolled back. Effects outside the database still happen: for example, an SMS accepted by addMessage is still delivered to the customer, and used values are still kept.
  • test2 — the request is not executed: the answer is a debug dump (HTML, HTTP 200) of the request headers and body as our server received them.
A request with any non-empty test value does not confirm that your server is up.
Enum:test1test2Example:test1

Examples

threeNumbers22 lines

Three numbers, with optional fields on the last two

{
  "numbers": [
    {
      "number": "+234112233445",
      "country_id": 234
    },
    {
      "number": "+234112233446",
      "country_id": 234,
      "date_start": 1543907600
    },
    {
      "number": "+234112233447",
      "country_id": 234,
      "date_start": 1543907600,
      "port_id": "Port1",
      "used": [
        "vkcom"
      ]
    }
  ]
}

Responses

200The list is accepted. Check the result of every number in ids.
Content-Typeapplication/json
Schema
schemaobject
responsestringRequired
Enum:1Example:1
idsanyOfRequiredResult per number. The key is the phone number as digits (country code included, no +). The value is the ID of the number on our server, null for a number that was removed from your list, or fail for a number that was not added. A number fails when it is not a phone number, the country is unknown, its port_id is already used by another of your numbers, it is online under another account, equipment_id is invalid, or rent is requested without rent access. An empty result is returned as an empty array [].

Examples

success

Two numbers added, one removed, one not a phone number

{
  "response": "1",
  "ids": {
    "234112233445": 1042,
    "234112233446": 1043,
    "234112233440": null,
    "abc": "fail"
  }
}
400numbers is not a list
Content-Typeapplication/json
Schema
schemaobjectError answer: response and message hold the same error code.
responsestringRequired
Enum:ERROR_PARAMS
messagestringRequired
Example:ERROR_PARAMS
401No API key, or the key does not exist. The body is the plain text Unauthorized. A request with Accept: application/json gets HTTP 200 with {"response":"ERROR_WRONG_KEY"} instead.
Content-Typetext/html
Schema
schemastring
Enum:Unauthorized.Example:Unauthorized.
403Forbidden: the API key is valid, but the request is refused. Error codes:
  • ERROR_DISABLED — the partner account is not activated;
  • ERROR_BANNED — the partner account is blocked;
  • ERROR_IP — the request comes from an IP address that is not in the account's allowlist;
  • ERROR_RENT — rent is requested, but the account has no rent access (addNumber only).
Content-Typeapplication/json
Schema
schemaobject
responsestringRequired
Error codeEnum:ERROR_DISABLEDERROR_BANNEDERROR_IPERROR_RENT
messagestringRequired
The same error code

Examples

ERROR_IP

Request from an IP address outside the allowlist

{
  "response": "ERROR_IP",
  "message": "ERROR_IP"
}

Code Samples

Generating examples...