> For the complete documentation index, see [llms.txt](https://experience.wallex.global/wallex-pay/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://experience.wallex.global/wallex-pay/merchant-tools/custom-apis/api-basics.md).

# API Basics

{% tabs %}
{% tab title="Introduction" %}

### **Introduction**

***

The WallexPay API will provide access to our services and information to our sellers. If you would like to see a particular function added, please click the Contact menu item above. API calls are implemented as standard HTTP POST (application/x-www-form-urlencoded) calls to **<http://wallexpay.io/api> .** Publickey and Privatekey need to get the bearer authentication token . Remaining all API response will get once possible to pass in header bearer token.

### API Setup

The only setup needed is to go to the API Keys page and generate an API key. You will be given a private and public key used to authenticate your API calls. Make sure you don't share your private key with any 3rd parties. User can able to create a maximum of 10 API Keys.

{% hint style="info" %}
**Note:** You must click "**Edit Permissions"** to enable most commands.
{% endhint %}

### API Response

The API will return an array with 1 or 2 elements: 'error' and 'result'. The result will always have an 'error' field. If its value is 'ok' (case-sensitive) the API call was a success, otherwise it will contain an error message. If there is data to return to you, it will be stored as an array in the 'result' element.

### **API POST Fields**

API calls are made as basic HTTP POST requests using the following variables: (note: The POST data is regular application/x-www-form-urlencoded style data, not JSON or XML).

### Main Fields: These fields will be here for all calls

<table><thead><tr><th width="188" align="center">Field Name</th><th width="410" align="center">Description</th><th align="center">Required?</th></tr></thead><tbody><tr><td align="center">version</td><td align="center">1</td><td align="center">Yes</td></tr><tr><td align="center">key</td><td align="center">Your API public key</td><td align="center">Yes</td></tr><tr><td align="center">cmd</td><td align="center">The API you are calling</td><td align="center">Yes</td></tr><tr><td align="center">nonce</td><td align="center">Optional nonce (an integer that is always higher than in your previous API call) to prevent replay attacks. This is optional, however once used with a particular key it must always be used with that key from then on. Note: API nonce processing is non-atomic so you always want to wait for an API call to return before making another.</td><td align="center">No</td></tr><tr><td align="center">format</td><td align="center">The format of response to return, json or xml. (default: json)</td><td align="center">No</td></tr></tbody></table>
{% endtab %}

{% tab title="Get Authorized Token" %}

### **Get Authorized Token**

***

For Wallex Pay users can get Authorized token by inserting public and private key in POST method.

Once user gets the Authorized bearer token it will be used for getting account info, user balances, receiving payments etc.

### &#x20;**API POST Fields**&#x20;

**Get Authorized Information**

<table><thead><tr><th width="202" align="center">Field Name</th><th width="323" align="center">Description</th><th align="center">Required?</th></tr></thead><tbody><tr><td align="center">cmd</td><td align="center">login</td><td align="center">Yes</td></tr></tbody></table>

`Method:`` `<mark style="color:blue;">`POST`</mark>\
`URL:` [`http://wallexpay.io/api/login`](http://wallexpay.io/api/login)\
`Requested Params:`` ``publickey, privatekey`

### **API Response**

A successful call to the 'login' command will give you a result similar to this (JSON):

```json
{
  "success": "true",
  "result": {
    "access_token": "Bearer <token>",
    "expires_at": "2020-08-16 13:28:32"
  },
  "message": "Login successfully!"
}
```

{% endtab %}
{% endtabs %}
