# 2. Receive create new user request

<figure><img src="/files/qwc9WTlje1aqLew7OnU9" alt=""><figcaption></figcaption></figure>

## **Description**

สร้างผู้ใช้งานใหม่ในระบบของท่านตามคำร้องขอของแพลตฟอร์มกลาง

Create a new user in your system based on the request from the central platform.

## **Endpoint URL**

`POST` /  `endpoint-tch/create-user` (สามารถตั้งชื่อ endpoint url เป็นชื่ออื่นได้; You can name the endpoint URL something else if desired.)

## **Request Body**

```typescript
{
    "userId": string
    //Request to create a new user in the target website's system.​
}
```

### **Success Response**

* **HTTP Status Code**: `201`
* **Structure**:

  <pre class="language-typescript"><code class="lang-typescript"><strong>{
  </strong>  "status": "success",
    "code": 201,
    "message": "User created successfully.",
    "data": {
      "userId": string
    }
  }
  </code></pre>

### **Error Responses**

* **400 Bad Request**: มีผู้ใช้งานอยู่ในระบบอยู่แล้ว(The user already exists in the system.)

  ```typescript
  {
    "status": "error",
    "code": 400,
    "message": "The user already exists in the system.",
  }
  ```
* **500 Internal Server Error**: error นอกเหนือจากที่กำหนดไว้ เช่น error try catch (Errors other than those specified, such as try-catch errors.)

  ```typescript
  {
    "status": "error",
    "code": 500,
    "message": string,
  }
  ```


---

# 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://document.thaicasino.tech/getting-started/step-3-setup-url-endpoint/2.-receive-create-new-user-request.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.
