> For the complete documentation index, see [llms.txt](https://docs.verifylink.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.verifylink.io/api.md).

# Start with API

## Start Testing

{% hint style="info" %}
**Note :** You can follow this guide to grab your API Keys, click [here](/account.md#grab-api-key)
{% endhint %}

Base endpoint : `https://verifylink.io`

## Create a request

<mark style="color:green;">`POST`</mark> `/api/v1`

The request should be a POST with the appropriate headers and body in raw format.

**Headers**

| Name         | Required | Value                |
| ------------ | -------- | -------------------- |
| Content-Type | true     | `application/json`   |
| apiKey       | true     | xxxxx-xxxxxxx-xxxxxx |

**Body**

<table><thead><tr><th>Name</th><th>Type</th><th width="102">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>url</code></td><td>string</td><td>true</td><td>https://example.com/offer?id=123</td></tr><tr><td><code>os</code></td><td>string</td><td>true</td><td>android or ios or desktop</td></tr><tr><td><code>version</code></td><td>string</td><td>true</td><td>This is OS version, it should be 13 if you want Android 13 or 17.5 if you want IOS 17.5</td></tr><tr><td><code>country</code></td><td>string</td><td>true</td><td>it should be two-letter country codes of country, for eg : US, GB</td></tr><tr><td><code>state</code></td><td>string</td><td>false</td><td>This should be state code, for New York, it should be NY</td></tr><tr><td><code>city</code></td><td>string</td><td>false</td><td>This should be city name in small characters for eg : newyork</td></tr><tr><td><code>zipcode</code></td><td>string</td><td>false</td><td>This should be valid zip code, for eg : 10013</td></tr><tr><td><code>isScreenshot</code></td><td>boolean</td><td>false</td><td>This should be either true or false</td></tr></tbody></table>

{% hint style="warning" %}
Note : If you set "isScreenshot" to true, each request will cost **10 credits**. Only enable this option if necessary.
{% endhint %}

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "message": "Process completed",
    "redirectUrls": [
        "https://surl.li/twxos",
        "http://surl.li/twxos",
        "https://bitly.cx/AB4W",
        "https://shorturl.at/2E86Q",
        "https://www.shorturl.at/2E86Q",
        "https://verifylink.io/"
    ],
    "screenshots": [],
    "statusCodes": [
        307,
        301,
        301,
        302,
        301,
        302
    ],
    "content": "<!DOCTYPE html><html lang=\"en\" class=\"nprogress-busy\" style=\"\"><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width\"><link rel=\"icon\" type=\"image/png\" href=\"/assets/images/site/favicon.png\"><meta name=\"title\" content=\"verifylink.io\"><meta name=\"description\" content=\"Verfiylink.io is the affiliate link testing application for affiliate marketers to test affiliate links based on various criteria like geolocation, device etc.\"><meta name=\"keywords\" content=\"link testing pla",
    "serverfailure": false,
    "destination": "website"
}
```

{% endtab %}

{% tab title="400" %}

```json
{
    "message": "Missing required parameters"
}
```

{% endtab %}
{% endtabs %}

## Examples

{% tabs %}
{% tab title="NodeJS" %}

```javascript
const https = require('https');

const data = JSON.stringify({
    url: 'https://surl.li/twxos',
    os: 'ios',
    version: '17.5',
    country: 'US'
});

const options = {
    hostname: 'verifylink.io',
    port: 443,
    path: '/api/v1',
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'apiKey': 'xxxxx-xxxxxxx-xxxxxx'
    }
};

const req = https.request(options, (res) => {
    let responseData = '';

    res.on('data', (chunk) => {
        responseData += chunk;
    });

    res.on('end', () => {
        try {
            const jsonResponse = JSON.parse(responseData);
            console.log('Message:', jsonResponse.message);
            console.log('Redirect URLs:', jsonResponse.redirectUrls);
            console.log('Screenshots:', jsonResponse.screenshots);
            console.log('Status Codes:', jsonResponse.statusCodes);
            console.log('Content:', jsonResponse.content.substring(0, 200) + '...'); // Print first 200 characters
            console.log('Server Failure:', jsonResponse.serverfailure);
            console.log('Destination:', jsonResponse.destination);
        } catch (error) {
            console.error('Error parsing response:', error);
        }
    });
});

req.on('error', (error) => {
    console.error('Error:', error);
});

req.write(data);
req.end();

```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$url = 'https://verifylink.io/api/v1';
$apiKey = 'xxxxx-xxxxxxx-xxxxxx';

$data = [
    'url' => 'https://surl.li/twxos',
    'os' => 'ios',
    'version' => '17.5',
    'country' => 'US'
];

$payload = json_encode($data);

$ch = curl_init($url);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'apiKey: ' . $apiKey
]);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    $responseData = json_decode($response, true);

    echo 'Message: ' . $responseData['message'] . PHP_EOL;
    echo 'Redirect URLs: ' . implode(', ', $responseData['redirectUrls']) . PHP_EOL;
    echo 'Screenshots: ' . implode(', ', $responseData['screenshots']) . PHP_EOL;
    echo 'Status Codes: ' . implode(', ', $responseData['statusCodes']) . PHP_EOL;
    echo 'Content: ' . substr($responseData['content'], 0, 200) . '...' . PHP_EOL; // Print first 200 characters
    echo 'Server Failure: ' . ($responseData['serverfailure'] ? 'true' : 'false') . PHP_EOL;
    echo 'Destination: ' . $responseData['destination'] . PHP_EOL;
}

curl_close($ch);

?>

```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

url = 'https://verifylink.io/api/v1'
api_key = 'xxxxx-xxxxxxx-xxxxxx'

data = {
    'url': 'https://surl.li/twxos',
    'os': 'ios',
    'version': '17.5',
    'country': 'US'
}

headers = {
    'Content-Type': 'application/json',
    'apiKey': api_key
}

response = requests.post(url, headers=headers, data=json.dumps(data))

if response.status_code == 200:
    response_data = response.json()
    print('Message:', response_data.get('message'))
    print('Redirect URLs:', response_data.get('redirectUrls', []))
    print('Screenshots:', response_data.get('screenshots', []))
    print('Status Codes:', response_data.get('statusCodes', []))
    print('Content:', response_data.get('content', '')[:200] + '...')  # Print first 200 characters
    print('Server Failure:', response_data.get('serverfailure'))
    print('Destination:', response_data.get('destination'))
else:
    print('Request failed with status code:', response.status_code)
    print('Response:', response.text)

```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'net/http'
require 'json'
require 'uri'

url = URI('https://verifylink.io/api/v1')
api_key = 'xxxxx-xxxxxxx-xxxxxx'

data = {
  url: 'https://surl.li/twxos',
  os: 'ios',
  version: '17.5',
  country: 'US'
}

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url.path, {
  'Content-Type' => 'application/json',
  'apiKey' => api_key
})
request.body = data.to_json

response = http.request(request)

if response.is_a?(Net::HTTPSuccess)
  response_data = JSON.parse(response.body)
  puts "Message: #{response_data['message']}"
  puts "Redirect URLs: #{response_data['redirectUrls'].join(', ')}"
  puts "Screenshots: #{response_data['screenshots'].join(', ')}"
  puts "Status Codes: #{response_data['statusCodes'].join(', ')}"
  puts "Content: #{response_data['content'][0, 200]}..." # Print first 200 characters
  puts "Server Failure: #{response_data['serverfailure']}"
  puts "Destination: #{response_data['destination']}"
else
  puts "Request failed with status code: #{response.code}"
  puts "Response: #{response.body}"
end

```

{% endtab %}

{% tab title="ExpressJS" %}

```javascript
const express = require('express');
const axios = require('axios');

const app = express();
const port = 3000;

app.use(express.json());

app.post('/verifylink', async (req, res) => {
    const apiUrl = 'https://verifylink.io/api/v1';
    const apiKey = 'xxxxx-xxxxxxx-xxxxxx';

    const requestData = {
        url: 'https://surl.li/twxos',
        os: 'ios',
        version: '17.5',
        country: 'US'
    };

    try {
        const response = await axios.post(apiUrl, requestData, {
            headers: {
                'Content-Type': 'application/json',
                'apiKey': apiKey
            }
        });

        const responseData = response.data;

        res.json({
            message: responseData.message,
            redirectUrls: responseData.redirectUrls,
            screenshots: responseData.screenshots,
            statusCodes: responseData.statusCodes,
            content: responseData.content.substring(0, 200) + '...', // Print first 200 characters
            serverfailure: responseData.serverfailure,
            destination: responseData.destination
        });
    } catch (error) {
        console.error('Error:', error);
        res.status(500).json({ error: 'An error occurred' });
    }
});

app.listen(port, () => {
    console.log(`Server is running on http://localhost:${port}`);
});


```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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.verifylink.io/api.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.
