The /batch API calls
Warning
The /batch endpoint is deprecated. This page is available for Partners using the legacy endpoint as a reference.
Use the following call to make multiple API calls with one HTTP request. Read the user guide here.
Batch Structures
Caution
Batch API calls allow your application to avoid throttling limits on sequential API calls. Your application can send up to 50 API calls within a batch. However, throttling will still apply to the batch API call itself.
Version: v2 2019-04-03
POST Endpoint
https://wepayapi.com/v2/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 | array of API Call Structure | An array of the API calls you want to make. |
Example
{
"client_id": 12345,
"client_secret": "abc123",
"calls": [
{
"call": "/user",
"authorization": "STAGE_abcdefghijklmnopqrstuvwxyz1234567890",
"reference_id": "1341351"
},
{
"call": "/checkout/create",
"authorization": "STAGE_abcdefghijklmnopqrstuvwxyz1234567890",
"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/create 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) | Object | The parameters required by the API call specified in the call parameter. |
Example 1
This API Call Structure makes a request to the /user endpoint. The endpoint doesn’t require any parameters, the field is not present, but it does require a user’s access token, which is provided in the authorization
field.
{
"call": "/user",
"authorization": "STAGE_abcdefghijklmnopqrstuvwxyz1234567890",
"reference_id": "1341351"
}
Example 2
This API Call Structure makes a request to the /checkout/create endpoint. The endpoint requires specific parameters and a user’s access token which are provided in the parameters
and authorization
fields respectively.
{
"call": "/checkout/create",
"authorization": "STAGE_abcdefghijklmnopqrstuvwxyz1234567890",
"reference_id": "23535111",
"parameters": {
"account_id": 12345,
"amount": 100,
"currency": "USD",
"short_description": "test",
"type": "goods"
}
}