# USAPI

# Login USAPI

##### Link:

<table border="1" id="bkmrk-environment-link-pro" style="border-collapse: collapse; width: 100%; height: 59.5938px;"><colgroup><col style="width: 50%;"></col><col style="width: 50%;"></col></colgroup><tbody><tr style="height: 29.7969px;"><td style="height: 29.7969px;">**Environment**</td><td style="height: 29.7969px;">**Link**</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">Production</td><td style="height: 29.7969px;">https://usapi.onindonesia.id</td></tr><tr><td>Demo</td><td>https://demousapi.onindonesia.id</td></tr></tbody></table>

##### Endpoint

<table border="1" id="bkmrk-endpoint-method-auth" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 50.0618%;"></col><col style="width: 50.0618%;"></col></colgroup><tbody><tr><td>**Endpoint**</td><td>**Method**  
</td></tr><tr><td>/auth</td><td>POST</td></tr></tbody></table>

##### Body request

```json
{
    "username": "usernew1",
    "password": "abc123",
    "options": {
        "nativeApp": false
    }
}
```

<table border="1" id="bkmrk-properties-propertie" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 23.115%;"></col><col style="width: 13.7206%;"></col><col style="width: 12.2373%;"></col><col style="width: 50.9271%;"></col></colgroup><tbody><tr><td>**Properties**  
</td><td>**Data type**</td><td>**Required**</td><td>**Description**</td></tr><tr><td>username</td><td>string</td><td>yes</td><td> </td></tr><tr><td>password</td><td>string</td><td>yes</td><td>  
</td></tr><tr><td>options</td><td>object</td><td>  
</td><td>  
</td></tr><tr><td>nativeApp</td><td>boolean</td><td>yes</td><td>This value determines whether the payload is coming from Mobile Apps ONAPPS (nativeApp: true) or not.</td></tr></tbody></table>

<details id="bkmrk-result-example-body-"><summary>Result example</summary>

<p class="callout info">OK (200)</p>

```json
{
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2Vy"
}
```

</details><details id="bkmrk-error-example-body-r"><summary>Error example</summary>

<p class="callout danger">Body request example</p>

```javascript
insert code here
```

</details>

# Account Registration -Internal

##### Endpoint

<table border="1" id="bkmrk-endpoint-method-auth" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 33.3333%;"></col><col style="width: 33.3333%;"></col><col style="width: 33.3333%;"></col></colgroup><tbody><tr><td>**Endpoint**</td><td>**Method**  
</td><td>**Authentication**</td></tr><tr><td><div><div>/internal/register</div></div></td><td>POST</td><td>Yes</td></tr></tbody></table>

##### Authentication

<table border="1" id="bkmrk-endpoint-method-serv" style="border-collapse: collapse; width: 100%; height: 59.757px;"><colgroup><col style="width: 29.5467%;"></col><col style="width: 45.5054%;"></col><col style="width: 24.9617%;"></col></colgroup><tbody><tr style="height: 29.8785px;"><td style="height: 29.8785px;">**Type**  
</td><td style="height: 29.8785px;">**Token source**  
</td><td style="height: 29.8785px;">**Server**  
</td></tr><tr style="height: 29.8785px;"><td style="height: 29.8785px;">Basic</td><td style="height: 29.8785px;">Internal</td><td style="height: 29.8785px;">USAPI</td></tr></tbody></table>

##### Header

<table border="1" id="bkmrk-parameter-value-%C2%A0" style="border-collapse: collapse; width: 100%; height: 59.757px;"><colgroup><col style="width: 64.5241%;"></col><col style="width: 35.4759%;"></col></colgroup><tbody><tr style="height: 29.8785px;"><td style="height: 29.8785px;">**Parameter**  
</td><td style="height: 29.8785px;">**Value**  
</td></tr><tr style="height: 29.8785px;"><td style="height: 29.8785px;">authorization</td><td>Basic &lt;auth key&gt;</td></tr></tbody></table>

##### Body request

```json
{
    "username": "test regis 3",
    "password": "test regis 3",
    "first_name": "second",
    "last_name": "test account",
    "phone_number": "621234567891",
    "email": "test@abc.com"
}
```

<table border="1" id="bkmrk-properties-propertie" style="border-collapse: collapse; width: 100%; height: 119.188px;"><colgroup><col style="width: 18.7886%;"></col><col style="width: 18.7886%;"></col><col style="width: 11.1248%;"></col><col style="width: 9.91942%;"></col><col style="width: 41.3785%;"></col></colgroup><tbody><tr style="height: 29.7969px;"><td style="height: 29.7969px;">**Properties**  
</td><td style="height: 29.7969px;">**Properties of**</td><td style="height: 29.7969px;">**Data type**</td><td style="height: 29.7969px;">**Required**</td><td style="height: 29.7969px;">**Description**</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">username</td><td style="height: 29.7969px;">  
</td><td style="height: 29.7969px;">string</td><td style="height: 29.7969px;">yes</td><td style="height: 29.7969px;">Username must be unique</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">password</td><td style="height: 29.7969px;">  
</td><td style="height: 29.7969px;">string</td><td style="height: 29.7969px;">yes</td><td style="height: 29.7969px;"></td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">first\_name</td><td style="height: 29.7969px;">  
</td><td style="height: 29.7969px;">string</td><td style="height: 29.7969px;">yes</td><td style="height: 29.7969px;"></td></tr><tr><td>last\_name</td><td>  
</td><td>string</td><td>yes</td><td></td></tr><tr><td>phone\_number</td><td>  
</td><td>string</td><td>yes</td><td>1. Phone number must be unique
2. Phone number format starts from 62 (62xxxx)
3. Without 62: Minimum length is 7 and maximum length is 15
4. With 62: Minimum length is 9 and maximum length is 17

</td></tr><tr><td>email</td><td>  
</td><td>string</td><td>yes</td><td>Email must be unique

</td></tr></tbody></table>

<details id="bkmrk-result-example-body-"><summary>Result example</summary>

<p class="callout info">200 Ok</p>

```javascript
{
  "status": true,
  "message": "Account has been created"
}
```

</details><details id="bkmrk-error-example-body-r"><summary>Error example</summary>

<p class="callout danger">400 Bad request  
Phone number is invalid</p>

```javascript
{
    "message": "Invalid phone number format"
}
```

<p class="callout danger">400 Bad request  
Duplicate phone number</p>

```javascript
{
    "message": "Phone number already exist"
}
```

<p class="callout danger">400 Bad request  
Duplicate username</p>

```javascript
{
    "message": "Username already exist"
}
```

<p class="callout danger">400 Bad request  
Duplicate email</p>

```javascript
{
    "message": "Email already exist"
}
```

<p class="callout danger">500 Internal server error</p>

```javascript
{
    "message": "Internal error"
}
```

</details>

# Account Registration (signup)

##### Endpoint

<table border="1" id="bkmrk-endpoint-method-auth" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 33.3333%;"></col><col style="width: 33.3333%;"></col><col style="width: 33.3333%;"></col></colgroup><tbody><tr><td>**Endpoint**</td><td>**Method**  
</td><td>**Authentication**</td></tr><tr><td><div><div>/signup</div></div></td><td>POST</td><td>Yes</td></tr></tbody></table>

##### Authentication

<table border="1" id="bkmrk-endpoint-method-serv" style="border-collapse: collapse; width: 100%; height: 59.757px;"><colgroup><col style="width: 29.5467%;"></col><col style="width: 45.5054%;"></col><col style="width: 24.9617%;"></col></colgroup><tbody><tr style="height: 29.8785px;"><td style="height: 29.8785px;">**Type**  
</td><td style="height: 29.8785px;">**Token source**  
</td><td style="height: 29.8785px;">**Server**  
</td></tr><tr style="height: 29.8785px;"><td style="height: 29.8785px;">Basic</td><td style="height: 29.8785px;">Internal</td><td style="height: 29.8785px;">USAPI</td></tr></tbody></table>

##### Header

<table border="1" id="bkmrk-parameter-value-%C2%A0" style="border-collapse: collapse; width: 100%; height: 59.757px;"><colgroup><col style="width: 64.5241%;"></col><col style="width: 35.4759%;"></col></colgroup><tbody><tr style="height: 29.8785px;"><td style="height: 29.8785px;">**Parameter**  
</td><td style="height: 29.8785px;">**Value**  
</td></tr><tr style="height: 29.8785px;"><td style="height: 29.8785px;">authorization</td><td>Basic &lt;auth key&gt;</td></tr></tbody></table>

##### Body request

```json
{
    "username": "test20250219000",
    "password": "test20250219000",
    "email": "hendy.juliyanto@ondelivery.id",
    "first_name": "test mail",
    "last_name": "without phone",
    "mode": "OTP",
    "phone_number": "62123456789",
    "platform": "ONAPPS"
}
```

<table border="1" id="bkmrk-properties-propertie" style="border-collapse: collapse; width: 100%; height: 392.391px;"><colgroup><col style="width: 18.7886%;"></col><col style="width: 18.7886%;"></col><col style="width: 11.1248%;"></col><col style="width: 9.91942%;"></col><col style="width: 41.3785%;"></col></colgroup><tbody><tr style="height: 29.7969px;"><td style="height: 29.7969px;">**Properties**  
</td><td style="height: 29.7969px;">**Properties of**</td><td style="height: 29.7969px;">**Data type**</td><td style="height: 29.7969px;">**Required**</td><td style="height: 29.7969px;">**Description**</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">username</td><td style="height: 29.7969px;">  
</td><td style="height: 29.7969px;">string</td><td style="height: 29.7969px;">yes</td><td style="height: 29.7969px;">Username must be unique</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">password</td><td style="height: 29.7969px;">  
</td><td style="height: 29.7969px;">string</td><td style="height: 29.7969px;">yes</td><td style="height: 29.7969px;"></td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">email</td><td style="height: 29.7969px;">  
</td><td style="height: 29.7969px;">string</td><td style="height: 29.7969px;">yes</td><td style="height: 29.7969px;">email must be unique

</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">first\_name</td><td style="height: 29.7969px;">  
</td><td style="height: 29.7969px;">string</td><td style="height: 29.7969px;">yes</td><td style="height: 29.7969px;"></td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">last\_name</td><td style="height: 29.7969px;">  
</td><td style="height: 29.7969px;">string</td><td style="height: 29.7969px;">yes</td><td style="height: 29.7969px;"></td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">mode</td><td style="height: 29.7969px;">  
</td><td style="height: 29.7969px;">string</td><td style="height: 29.7969px;">no</td><td style="height: 29.7969px;">Possible values: "LINK" or "OTP"

"LINK": Verification via email

"OTP": Verification via SMS

</td></tr><tr style="height: 154.016px;"><td style="height: 154.016px;">phone\_number</td><td style="height: 154.016px;">  
</td><td style="height: 154.016px;">string</td><td style="height: 154.016px;">no</td><td style="height: 154.016px;">1. Phone number must be unique
2. Phone number format starts from 62 (62xxxx)
3. Without 62: Minimum length is 7 and maximum length is 15
4. With 62: Minimum length is 9 and maximum length is 17

</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">platform</td><td style="height: 29.7969px;">  
</td><td style="height: 29.7969px;">string</td><td style="height: 29.7969px;">no</td><td style="height: 29.7969px;">Possible values:

- ONMART
- ONMARKET
- OSAS

</td></tr></tbody></table>

<details id="bkmrk-result-example-body-"><summary>Result example</summary>

<p class="callout info">200 OK (LINK mode)</p>

```json
{
    "status": true,
    "message": "Please check your email to complete registration",  
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoidGVzdGFjY291bnQyMDI1MDIyNDAwMCIsInVzZXJuYW1lIjoidGVzdGFjY291bnQyMDI1MDIyNDAwMCIsInB3ZCI6IiQyYiQwOCRUT2djQS5oV1VhSUVlQ05ySnIxRVIuRERpaW8vbVFDSTNWVWZvWnFKcTQyVXBaZkFWNUpMdSIsImVtYWlsIjoiaGVuZHkuanVsaXlhbnRvQG9uZGVsaXZlcnkuaWQiLCJmaXJzdF9uYW1lIjoidGVzdCBhY2NvdW50IiwibGFzdF9uYW1lIjoid2l0aCBlbWFpbCIsInBob25lX251bWJlciI6bnVsbCwibW9kZSI6IkxJTksiLCJleHAiOjE3NDAzNjg5NjQsIm90cCI6IjgzNDkzMSIsImlhdCI6MTc0MDM2NzE2NH0.V0l-YGLJ08FvmmH3HF4phrEKBUzJmelAJnXZOkIHu4E",
    "exp": 1740368964,
    "exp_otp": 18000
}
```

</details><details id="bkmrk-error-example-body-r"><summary>Error example</summary>

<p class="callout danger">400 Bad request  
Phone number is invalid</p>

```json
{
    "message": "The phone number format is invalid. Please use the format: 628XXXXXXXXX"
}
```

<p class="callout danger">400 Bad request  
Duplicate phone number</p>

```json
{
    "message": "Phone number already exist"
}
```

<p class="callout danger">400 Bad request  
Duplicate username</p>

```json
{
    "message": "Username already exist"
}
```

<p class="callout danger">400 Bad request  
Duplicate email</p>

```json
{
    "message": "Email already exist"
}
```

<p class="callout danger">500 Internal server error</p>

```json
{
    "message": "Internal error"
}
```

</details>

# Update basic profile

##### Endpoint

<table border="1" id="bkmrk-endpoint-method-auth" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 33.3333%;"></col><col style="width: 33.3333%;"></col><col style="width: 33.3333%;"></col></colgroup><tbody><tr><td>**Endpoint**</td><td>**Method**  
</td><td>**Authentication**</td></tr><tr><td>/update-basic-profile</td><td>POST</td><td>Yes</td></tr></tbody></table>

##### Authorization

<table border="1" id="bkmrk-endpoint-method-serv" style="border-collapse: collapse; width: 100%; height: 59.757px;"><colgroup><col style="width: 29.5467%;"></col><col style="width: 45.5054%;"></col><col style="width: 24.9617%;"></col></colgroup><tbody><tr style="height: 29.8785px;"><td style="height: 29.8785px;">**Type**  
</td><td style="height: 29.8785px;">**Token source**  
</td><td style="height: 29.8785px;">**Server**  
</td></tr><tr style="height: 29.8785px;"><td style="height: 29.8785px;">Bearer</td><td style="height: 29.8785px;">login USAPI</td><td style="height: 29.8785px;">USAPI</td></tr></tbody></table>

##### Header

<table border="1" id="bkmrk-parameter-value-%C2%A0" style="border-collapse: collapse; width: 100%; height: 59.757px;"><colgroup><col style="width: 64.5241%;"></col><col style="width: 35.4759%;"></col></colgroup><tbody><tr style="height: 29.8785px;"><td style="height: 29.8785px;">**Parameter**  
</td><td style="height: 29.8785px;">**Value**  
</td></tr><tr style="height: 29.8785px;"><td style="height: 29.8785px;">Authorization</td><td>Bearer &lt;auth&gt;</td></tr></tbody></table>

##### Body request

<p class="callout info">Content-Type: multipart/form-data</p>

<table border="1" id="bkmrk-properties-propertie" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 18.7886%;"></col><col style="width: 18.7886%;"></col><col style="width: 11.1248%;"></col><col style="width: 9.91942%;"></col><col style="width: 41.3785%;"></col></colgroup><tbody><tr><td>**Properties**  
</td><td>**Properties of**</td><td>**Data type**</td><td>**Required**</td><td>**Description**</td></tr><tr><td>basic\_profile</td><td>  
</td><td>  
</td><td>  
</td><td>  
</td></tr><tr><td>date\_of\_birth</td><td>basic\_profile</td><td>string</td><td>yes</td><td>  
</td></tr><tr><td>gender</td><td>basic\_profile</td><td>string</td><td>yes</td><td>Accepted values:

1. Laki-Laki
2. <div><div>Perempuan</div></div>

</td></tr><tr><td>phone\_number</td><td>basic\_profile</td><td>string</td><td>yes</td><td>  
</td></tr><tr><td>profile\_img</td><td>  
</td><td>file</td><td>no</td><td>  
</td></tr></tbody></table>

Example:

<table border="1" id="bkmrk-properties-value-bas" style="border-collapse: collapse; width: 100%; height: 235.797px;"><colgroup><col style="width: 50.0596%;"></col><col style="width: 50.0596%;"></col></colgroup><tbody><tr style="height: 29.7969px;"><td style="height: 29.7969px;">**Properties**  
</td><td style="height: 29.7969px;">**Value**</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">basic\_profile</td><td style="height: 29.7969px;"><div class="" data-block="true" data-editor="53jij" data-offset-key="1j1th-0-0"><div class="public-DraftStyleDefault-block public-DraftStyleDefault-ltr" data-offset-key="1j1th-0-0"><span data-offset-key="1j1th-0-0"><span data-text="true">{</span></span></div></div><div class="" data-block="true" data-editor="53jij" data-offset-key="5l79m-0-0"><div class="public-DraftStyleDefault-block public-DraftStyleDefault-ltr" data-offset-key="5l79m-0-0"><span data-offset-key="5l79m-4-0"><span data-text="true"> "gender": "Laki-Laki",</span></span></div></div><div class="" data-block="true" data-editor="53jij" data-offset-key="6cfv9-0-0"><div class="public-DraftStyleDefault-block public-DraftStyleDefault-ltr" data-offset-key="6cfv9-0-0"><span data-offset-key="6cfv9-4-0"><span data-text="true"> "phone\_number": "6287654321",</span></span></div></div><div class="" data-block="true" data-editor="53jij" data-offset-key="albhf-0-0"><div class="public-DraftStyleDefault-block public-DraftStyleDefault-ltr" data-offset-key="albhf-0-0"><span data-offset-key="albhf-4-0"><span data-text="true"> "date\_of\_birth": "1996-10-18"</span></span></div></div><div class="" data-block="true" data-editor="53jij" data-offset-key="4ndrf-0-0"><div class="public-DraftStyleDefault-block public-DraftStyleDefault-ltr" data-offset-key="4ndrf-0-0"><span data-offset-key="4ndrf-0-0"><span data-text="true">}</span></span></div></div></td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">profile\_img</td><td style="height: 29.7969px;">image.jpg</td></tr></tbody></table>

<details id="bkmrk-result-example-body-"><summary>Result example</summary>

<p class="callout info">200 OK</p>

```javascript
{
    "status": true,
    "message": "Success update profile"
}
```

</details><details id="bkmrk-error-example-body-r"><summary>Error example</summary>

<p class="callout danger">500 Internal server error</p>

```javascript
{
    "message": "Error on update profile."
}
```

</details>

# Email verification

##### Endpoint

<table border="1" id="bkmrk-endpoint-method-auth" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 33.3333%;"></col><col style="width: 33.3333%;"></col><col style="width: 33.3333%;"></col></colgroup><tbody><tr><td>**Endpoint**</td><td>**Method**  
</td><td>**Authentication**</td></tr><tr><td><div><div>/check/email</div></div></td><td>POST</td><td>no</td></tr></tbody></table>

##### Body request

```json
{
  "email": "value"
}
```

<table border="1" id="bkmrk-properties-propertie" style="border-collapse: collapse; width: 100%; height: 59.5938px;"><colgroup><col style="width: 18.7886%;"></col><col style="width: 18.7886%;"></col><col style="width: 11.1248%;"></col><col style="width: 9.91942%;"></col><col style="width: 41.3785%;"></col></colgroup><tbody><tr style="height: 29.7969px;"><td style="height: 29.7969px;">**Properties**  
</td><td style="height: 29.7969px;">**Properties of**</td><td style="height: 29.7969px;">**Data type**</td><td style="height: 29.7969px;">**Required**</td><td style="height: 29.7969px;">**Description**</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">email</td><td style="height: 29.7969px;">  
</td><td style="height: 29.7969px;">string</td><td style="height: 29.7969px;">yes</td><td style="height: 29.7969px;">  
</td></tr></tbody></table>

<details id="bkmrk-result-example-body-"><summary>Result example</summary>

<p class="callout success">200 Ok</p>

```json
{
    "status": true,
    "message": "Email is not registered"
}
```

</details><details id="bkmrk-error-example-body-r"><summary>Error example</summary>

<p class="callout danger">409 Conflict  
</p>

```json
{
    "status": false,
    "message": "Email is already registered"
}
```

<p class="callout danger">400 Bad Request</p>

```json
{
    "message": "Must have required property 'email'"
}
```

</details>