# API เพิ่มลูกค้า

## Create a new customer

<mark style="color:orange;">`POST`</mark> `/`[`https://global.nextpoint.me/next-global/nextpoint/api/customer`](https://global.nextpoint.me/next-global/nextpoint/api/customer)

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

```markup
curl --location
-H "publicKey : <your_publicKey> "
-H "secretKey : <your_secretKey> " 
-H "token: <your_token> "
--data '{"phone":"<phone_number_of_customer>"}' 
--request POST https://global.nextpoint.me/next-global/nextpoint/api/customer





```

{% endtab %}

{% tab title="PHP (cURL)" %}

```php
$ch = curl_init();  
$url  = 'https://global.nextpoint.me/next-global/nextpoint/api/customer'; 
$body = array( 'phone' => '<phone_number_of_customer>' );
$headers = array( 
    'publicKey: <your_publicKey>', 
    'secretKey: <your_secretKey>' 
    'token: <your_token>' );  
curl_setopt($ch, CURLOPT_URL, $url );  
curl_setopt($ch, CURLOPT_POST,true );  
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers ); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true ); 
curl_setopt($ch, CURLOPT_POSTFIELDS, 
json_encode( $body )
);
$response = curl_exec($ch); 
url_close($ch); 
echo $response;
```

{% endtab %}

{% tab title="NodeJS(Axios)" %}

```markup
 const axios = require('axios');  
 const url = 'https://global.nextpoint.me/next-global/nextpoint/api/customer'; 
 const headers = { 
  'publicKey' : '<your_publicKey>',  
  'secretKey' : '<your_secretKey>' };  
  'Authorization': 'Bearer ' : '<your_token>' };  
const body = { phone: '<phone_number_of_customer>' } 
axios.post( url, body, { headers } ).then(response => { 
console.log(response.data);  
}).catch(error => { 
console.log(error);  }); 
```

{% endtab %}

{% tab title="Python" %}

```python
 import requests url = 'https://global.nextpoint.me/next-global/nextpoint/api/customer';
 headers = { 
  'publicKey' : '<your_publicKey>', 
  'secretKey' : '<your_secretKey>', 
  'token' : '<your_token>' }
  body = { 'phone': '<phone_number_of_customer>', }
  response = requests.post(url, headers=headers ) 
  if response.status_code == 200: 
    print(response.text) 
    else: 
      print(f"Error {response.status_code}: {response.reason}")
```

{% endtab %}
{% endtabs %}

**Headers**

| Name      | Value                                                                                                |
| --------- | ---------------------------------------------------------------------------------------------------- |
| publicKey | สามารถคัดลอกได้ที่หน้า [เปิดใช้งาน API](/nextpoint/developer-api/api.md)                             |
| secretKey | สามารถคัดลอกได้ที่หน้า [เปิดใช้งาน API](/nextpoint/developer-api/api.md)                             |
| token     | `Bearer <token>` สามารถขอได้จาก [API Connect](/nextpoint/developer-api/api-reference/api-connect.md) |

**Body**

| Name    | Type   | Description            |
| ------- | ------ | ---------------------- |
| `phone` | string | เบอร์โทรศัพท์ของลูกค้า |

**Response**

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

```json
{
    "status": "OK",
    "statusCode": 200,
    "message": "Create Customer Successfully",
    "headers": {
        "date": "Wed, 13 Mar 2024 08:32:32 GMT",
        "connection": "close"
    }
}
```

{% endtab %}

{% tab title="401" %}

```json
{
    "status": 401,
    "message": "No token provided!"
}

```

{% endtab %}

{% tab title="303" %}

```json
{
"statusCode" : 303 ,
"status" : "See Other" ,
"message" : "duplicate data customer"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nexttechcapital.gitbook.io/nextpoint/developer-api/api-reference/api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
