# Agency Sync

API URI

```bash
https://api.versal.one/<uuid>
```

Method

```
POST /agency/sync
```

#### **Description**

This API synchronizes agency data using a unique identifier (`uuid`). The client must provide an authorization token to access this endpoint. The API responds with success, error, or status messages based on the input and server-side processes.

---

#### **Request Headers**

<table id="bkmrk-header-type-descript"><thead><tr><th>Header</th><th>Type</th><th>Description</th><th>Constraints</th></tr></thead><tbody><tr><td>`Authorization`</td><td>String</td><td>Bearer token for authentication and authorization.</td><td>Required. Must be in the format `Bearer [token]`.</td></tr></tbody></table>

---

#### **Query Parameters**

<table id="bkmrk-field-type-descripti"><thead><tr><th>Parameter</th><th>Type</th><th>Description</th><th>Constraints</th></tr></thead><tbody><tr><td>`uuid`</td><td>String</td><td>Unique identifier for the agency.</td><td>Required. Must be a valid UUID format.</td></tr></tbody></table>

---

#### **Response Codes**

<table id="bkmrk-status-code-descript"><thead><tr><th>Status Code</th><th>Description</th></tr></thead><tbody><tr><td>`200`</td><td>Sync completed successfully. Returns a success message.</td></tr><tr><td>`400`</td><td>Bad request. The `uuid` parameter is missing or invalid.</td></tr><tr><td>`403`</td><td>Access forbidden. Invalid HMAC signature.</td></tr><tr><td>`404`</td><td>No agency found with the provided `uuid`.</td></tr><tr><td>`500`</td><td>Internal server error. Something went wrong on the backend.</td></tr></tbody></table>

---

#### **Example Requests**

**Request (Sync Agency):**

```bash
 POST /53d1bcd3-aaf0-45e1-9298-5395b6a27b61/agency/sync
 Authorization: Bearer 5395b6a27b61 
```

**Response (Sync Complete - 200):**

```json
 { "status": true, "message": "Sync Complete" } 
``` 

**Response (Missing UUID - 400):**

```json
 { "success": false, "message": "Bad Request: Missing uuid parameter" } 
``` 

**Response (Invalid HMAC - 403):**

```json
 { "success": false, "message": "Forbidden: Invalid HMAC signature" } 
``` 

**Response (Not Found - 404):**

```json
 { "success": false, "message": "No company found with the provided uuid" } 
``` 

**Response (Server Error - 500):**

```json
 { "status": false, "message": "Something went wrong on the backend" } 
``` 

---

#### **Notes**

- **Authentication**: The authorization token must be valid. If it is missing or invalid, the request will fail.
- **Field Validation**: Ensure the `uuid` parameter is correctly formatted as a valid UUID.
- **Error Handling**: For 500 errors, consult server logs for debugging.