# Agency Read Campaign

API URI

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

```
GET /agency/getCampaignData
```

#### **Description**

This API retrieves campaign data for a specified agency using a unique identifier (`uuid`). It supports pagination for large datasets. A valid JWT token is mandatory for authentication and authorization.

---

#### **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>JWT 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>Field</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.</td></tr><tr><td>`page`</td><td>Integer</td><td>Page number for pagination.</td><td>Optional. Defaults to 1.</td></tr><tr><td>`limit`</td><td>Integer</td><td>Number of items per page.</td><td>Optional. Defaults to 10.</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>Success. Campaigns retrieved successfully.</td></tr><tr><td>`400`</td><td>Invalid pagination parameters or missing `uuid` parameter.</td></tr><tr><td>`403`</td><td>Forbidden: Invalid HMAC signature.</td></tr><tr><td>`404`</td><td>No campaigns found for the provided `uuid` or no company associated with the `uuid`.</td></tr><tr><td>`500`</td><td>An unexpected error occurred while fetching the campaigns.</td></tr></tbody></table>

---

#### **Example Requests**

**Request:**

```json

GET 53d1bcd3-aaf0-45e1-9298-5395b6a27b61/agency/getCampaignData?page=1&limit=10
Authorization: Bearer 5395b6a27b61

```

**Response (200 - Success):**

```json

{
  "success": true,
  "message": "Campaigns retrieved successfully.",
  "data": [
    // List of campaigns
  ],
  "pagination": {
    "total": 100,
    "page": 1,
    "limit": 10,
    "totalPages": 10
  }
}

```

**Response (400 - Invalid Parameters):**

```json

{
  "success": false,
  "message": "Invalid pagination parameters."
}

```

**Response (403 - Forbidden):**

```json

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

```

**Response (404 - No Campaigns Found):**

```json

{
  "success": false,
  "message": "No campaigns found for the given UUID."
}

```

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

```json

{
  "success": false,
  "message": "An unexpected error occurred while fetching the campaigns.",
  "error": "Error details here"
}

```

---

#### **Notes**

- **Authentication:** Ensure the JWT token is valid. Invalid or missing tokens will result in a 403 or 401 error.
- **Field Validation:** The `uuid` field is mandatory for this request.
- **Error Handling:** Review server logs for debugging 500 errors.
- **Pagination:** If the `page` or `limit` is invalid, a 400 error is returned.