# Authentication

All requests must include your unique <mark style="background-color:orange;">App Key</mark> & <mark style="background-color:orange;">Secret Key</mark>, Which you will find in Offer Api section of your Dashboard. As shown in below image.

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

## How to access the API

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.playtimeads.com/Api/Offers',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'AppKey: <YOUR_APP_KEY>',
    'AppSecretKey: <YOUR_SECRET_KEY>'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

{% hint style="warning" %}
Replace `“<YOUR_APP_KEY>”` and `"<YOUR_SECRET_KEY>"` with your actual keys provided in your dashboard as shown in above image.
{% endhint %}

## Example Response

```json
{
    "total_offers": 1,
    "total_page": 1,
    "page": 1,
    "limit": 1000,
    "Offers": [
        {
            "campaignId": "XXXXXX01",
            "totalPayout": 9.999,
            "status": "active",
            "campaignName": "Sample Game Campaign",
            "description": "<p>Step 1: Tap Play Now and install the app.<br />\r\nStep 2: Open the app to start.<br />\r\nStep 3: Complete the first level.<br />\r\nStep 4: Keep playing to earn more rewards!</p>\r\n",
            "model": "CPL",
            "app": {
                "title": "Sample Game",
                "packageName": "com.example.samplegame",
                "previewUrl": "https://play.google.com/store/apps/details?id=com.example.samplegame",
                "logo": "https://example.com/images/sample_logo.jpg",
                "bannerImage": "https://example.com/images/sample_thumbnail.jpg"
            },
            "currency": {
                "name": "USD",
                "symbol": "$"
            },
            "payoutEvents": [
                {
                    "event": "level_1_complete",
                    "eventTitle": "Complete Level 1",
                    "eventDesc": "",
                    "payoutAmount": 0.010,
                    "targetCaps": "0"
                },
                {
                    "event": "level_5_complete",
                    "eventTitle": "Complete Level 5",
                    "eventDesc": "",
                    "payoutAmount": 0.050,
                    "targetCaps": "0"
                },
                {
                    "event": "level_10_complete",
                    "eventTitle": "Complete Level 10",
                    "eventDesc": "",
                    "payoutAmount": 0.500,
                    "targetCaps": "0"
                },
                {
                    "event": "boss_level_complete",
                    "eventTitle": "Defeat Final Boss",
                    "eventDesc": "",
                    "payoutAmount": 1.000,
                    "targetCaps": "0"
                },
                {
                    "event": "game_completed",
                    "eventTitle": "Finish the Game",
                    "eventDesc": "",
                    "payoutAmount": 5.000,
                    "targetCaps": "0"
                }
            ],
            "targeting": {
                "os": "android",
                "countries": [
                    {
                        "iso": "US"
                    }
                ]
            },
            "tracking": {
                "clickUrl": "http://tracking.example.com/track/oa/XXXXXXX/XXXXXX01/?clickId={clickId}&gaid={gaid}&sub1={sub1}...&sub10={sub10}",
                "impressionUrl": "https://tracking.example.com/i/XXXXXX01/{publisher_id}"
            }
        }
    ]
}

```

{% hint style="success" %}
**status** – Indicates whether the offer is currently available. Value can be `active` (offer is live) or `paused` (offer is temporarily unavailable, usually due to cap being reached).
{% endhint %}

## Click Url Tracking Parameters&#x20;

| Parameter          | Description                                                                                                                                                                      |
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| {clickId}          | Pass the unique user ID from your platform that distinctly identifies each user.                                                                                                 |
| {gaid}             | Pass the user’s Google Advertising ID in this parameter to enable accurate tracking and attribution.                                                                             |
| {sub1}  to {sub10} | These are optional parameters that allow the publisher to send custom user information, which will be returned in same parameter in postback to help identify or track the user. |


---

# 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://docs.playtimeads.com/api-integration/authentication.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.
