The /batch API calls

Use the following call to make multiple API calls with one HTTP request.

Caution

The maximum number of API calls that you can make in a single batch call is 50 calls. In addition, you can make these calls without being throttled.

Version: v2 2016-08-10

POST Endpoint

https://wepayapi.com/batch

/batch/create

Use the /batch/create call to make multiple API calls within a single API call. Each call has a reference_id that can be used to identify it. In addition, an access_token will be passed for each call in the list, allowing you to make batch API calls for multiple users.

Arguments

Parameter Required Type Description
client_id Yes Integer (64 bits) The ID for your API application. It can found on your application's dashboard.
client_secret Yes String (255 chars) The secret for your API application. It can found on your application's dashboard.
calls Yes API Call Structure An array of the API calls you want to make.

Example

{
   "client_id": 12345,
   "client_secret": "abc123",
   "calls": [
      {
         "call": "/user",
         "authorization": "asd3522342f",
         "reference_id": "1341351",
         "parameters": {}
      },
      {
         "call": "/checkout/create",
         "authorization": "asd3522342f",
         "reference_id": 23535111,
         "parameters": {
            "account_id": 12345,
            "amount": 100,
            "currency": "USD",
            "short_description": "test",
            "type": "goods"
         }
      }
   ]
}

Response

Response Type Description
calls Array An array of responses to all the API calls made in the /batch call.

Example

{
   "calls": [
      {
         "call": "/user",
         "reference_id": "1341351",
         "response": {
            "user_id": 54312,
            "email": "test@example.com",
            "first_name": "bob",
            "last_name": "smith"
         }
      },
      {
         "call": "/checkout/create",
         "reference_id": "23535111",
         "response": {
            "error": "access_denied",
            "error_description": "this account can no longer transact",
            "error_code": 3004
         }
      }
   ]
}

API Call Structure

Contains API calls and their associated arguments.

Fields

Field Required Type Description
call Yes String (255 chars) The name of the call you want to make (e.g., /checkout/find).
authorization Yes (if the API call requires authorization) String (255 chars) The access token of the user making the API call.
reference_id No String (255 chars) A unique ID you can attach to an API call to identify it.
parameters Yes (if the API call requires parameters) Array The parameters required by the API call specified in the call parameter.

Example

"calls": [
   {
      "call":"/user",
      "reference_id":"1341351",
      "response":{
         "user_id":54312,
         "email":"test@example.com",
         "first_name":"bob",
         "last_name":"smith"
      }
   },
   {
      "call":"/checkout/create",
      "reference_id":"23535111",
      "response":{
         "error":"access_denied",
         "error_description":"this account can no longer transact",
         "error_code":3004
      }
   }
]