> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://apidoc-v1.maniscloud.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://apidoc-v1.maniscloud.com/_mcp/server.

# Get token

POST https://api/v1/auth/token

This API endpoint allows clients to retrieve an access token by providing valid authentication credentials. The access token is used to authorize subsequent API requests.

**Request Header**

- `x-secret:` the merchant's secret
    
- `x-merchant-id:`the merchant's id
    

**Response Body**

200 OK

| **Field** | type |
| --- | --- |
| tokenType | string |
| token | string |
| expiresAt | timestamp |

400 BAD REQUEST

| **Field** | type |
| --- | --- |
| timestamp | date(yyyy-MM-dd'T'HH:mm:ss.SSS'Z') |
| title | string |
| type | string |
| status | number |
| soaCode | string |
| detail | string |

Reference: https://apidoc-v1.maniscloud.com/manis-unified-api-v-1-0/authentication/get-token

## Servers

- `https:/` (https://{url}, default)
- `https:/` (https://{devurl})

## Request

### Headers

- `x-merchant-id` (string, optional)
- `x-secret` (string, optional)

## Response

### 200

OK

- `token` (string, required)
- `expiresAt` (integer, required)
- `tokenType` (string, required)

## Examples

**Response**

```json
{
  "token": "eyJraWQiOiJtYW5pcy1wYXltZW50IiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJzdWIiOiJNYW5pc1BheW1lbnQiLCJhdWQiOlsicGF5bWVudF9jZW50ZXIiLCJwc3BfaHViIl0sIm5iZiI6MTc0OTYyMTc1MSwicm9sZSI6Ik1FUkNIQU5UX0FQSSIsIm1lcmNoYW50SWQiOiI1ZTFmYmNhMS0zNTg0LTQ5NGItYmM0YS00N2Y2ZDE5NjQxMjgiLCJpc3MiOiJtYW5pcy1wYXltZW50IiwidXNySWQiOiI1ZTFmYmNhMS0zNTg0LTQ5NGItYmM0YS00N2Y2ZDE5NjQxMjgiLCJleHAiOjE3NDk2MjM1NTEsImlhdCI6MTc0OTYyMTc1MSwianRpIjoiMzhiYzAzYmUtZDU2OS00YzY4LThlZDctZTgyMWY3ODZkM2YzIn0.A46FkU8qB96T7WnQMsKNoWnrTs6b8nAuppF8MJdTXbM",
  "expiresAt": 1749623551,
  "tokenType": "Bearer"
}
```

**SDK Code**

```python Authentication_Get token_example
import requests

url = "https://https/api/v1/auth/token"

headers = {
    "x-merchant-id": "{{merchantId}}",
    "x-secret": "{{merchantSecret}}"
}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript Authentication_Get token_example
const url = 'https://https/api/v1/auth/token';
const options = {
  method: 'POST',
  headers: {'x-merchant-id': '{{merchantId}}', 'x-secret': '{{merchantSecret}}'}
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Authentication_Get token_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://https/api/v1/auth/token"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("x-merchant-id", "{{merchantId}}")
	req.Header.Add("x-secret", "{{merchantSecret}}")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Authentication_Get token_example
require 'uri'
require 'net/http'

url = URI("https://https/api/v1/auth/token")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-merchant-id"] = '{{merchantId}}'
request["x-secret"] = '{{merchantSecret}}'

response = http.request(request)
puts response.read_body
```

```java Authentication_Get token_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://https/api/v1/auth/token")
  .header("x-merchant-id", "{{merchantId}}")
  .header("x-secret", "{{merchantSecret}}")
  .asString();
```

```php Authentication_Get token_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://https/api/v1/auth/token', [
  'headers' => [
    'x-merchant-id' => '{{merchantId}}',
    'x-secret' => '{{merchantSecret}}',
  ],
]);

echo $response->getBody();
```

```csharp Authentication_Get token_example
using RestSharp;

var client = new RestClient("https://https/api/v1/auth/token");
var request = new RestRequest(Method.POST);
request.AddHeader("x-merchant-id", "{{merchantId}}");
request.AddHeader("x-secret", "{{merchantSecret}}");
IRestResponse response = client.Execute(request);
```

```swift Authentication_Get token_example
import Foundation

let headers = [
  "x-merchant-id": "{{merchantId}}",
  "x-secret": "{{merchantSecret}}"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://https/api/v1/auth/token")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```