# API Documentation

1\. Intro

This API delivers a list of projects and URLs flagged for copyright infringement in Google Search. It provides a streamlined interface to integrate our data into your systems, enhancing your ability to monitor and address copyright violations effectively.

{% hint style="info" %}
Please note that this API is exclusively available for Pro & Max subscription projects. If you are using the free search from the landing page or the Meter subscription, you will not have access to this data via the API. This limitation ensures the robustness and responsiveness of our API for Pro & Max subscribers, providing a more personalized and efficient experience. Please consider upgrading to a Pro or Max subscription to gain access to this valuable resource.
{% endhint %}

In this documentation, you will find detailed instructions on how to interact with our API, from setting up authentication, to crafting requests and handling responses. This includes complete definitions for all available endpoints, detailed field descriptions, and numerous examples to assist you in your development journey.

We appreciate your interest in our API and look forward to supporting you in integrating our data into your applications, services, or workflows. Please review this documentation carefully, and don't hesitate to reach out if you have any questions or require further information.

## 2. Base URL

The base URL for the PiracyMeter API is: `https://piracymeter.com/api/v1`

## 3. Authentification

To authenticate your requests, you can use one of the available authentification methods:

* using `Authorization` header;
* using `key` variable in the query string.

For the first authentification method, you need to include the `Authorization` header with the value of `Bearer` followed by your API key. The API key can be obtained from the "Account & Billing" section at piracymeter.com.

{% embed url="<https://www.canva.com/design/DAGlYGIFNo4/Y07V2Z3947HLER5c8KVoyA/watch>" %}
How to Get Your API Key from Piracymeter
{% endembed %}

**Example:**

```vbnet
Authorization: Bearer <your-api-key>
```

If you prefer to define your authorization key directly in the query string, you can use the second method.

**Example:**

```
https://piracymeter.com/api/v1/projects?key=<your-api-key>
```

### Request Headers

All requests to the Piracymeter API should include the following request header:

* `Accept: application/json` - Indicates that you expect the response to be in JSON format.

### Authentication with Bearer Header

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

```bash
curl --location 'https://piracymeter.com/api/v1/projects' \
--header 'Authorization: Bearer <your-api-key>' \
--header 'Accept: application/json'

```

{% endtab %}

{% tab title="JavaScript (jQuery)" %}

```javascript
var settings = {
  "url": "https://piracymeter.com/api/v1/projects",
  "method": "GET",
  "headers": {
    "Authorization": "Bearer <your-api-key>",
    "Accept": "application/json"
  },
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

{% endtab %}

{% tab title="Node.js (Axios)" %}

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

const config = {
  method: 'get',
  url: 'https://piracymeter.com/api/v1/projects',
  headers: {
    'Authorization': 'Bearer <your-api-key>',
    'Accept': 'application/json'
  }
};

axios(config)
  .then(function (response) {
    console.log(response.data);
  })
  .catch(function (error) {
    console.log(error);
  });
```

{% endtab %}

{% tab title="PHP (Guzzle)" %}

```php
<?php
$client = new Client();
$headers = [
  'Authorization' => 'Bearer <your-api-key>'
  'Accept' => 'application/json'
];
$request = new Request('GET', 'https://piracymeter.com/api/v1/projects', $headers);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();

```

{% endtab %}

{% tab title="PHP (cURL)" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://piracymeter.com/api/v1/projects",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <your-api-key>",
    "Accept: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

```

{% endtab %}

{% tab title="Python" %}

```python
import http.client
 
conn = http.client.HTTPSConnection("piracymeter.com")
payload = ''
headers = {
  'Authorization': 'Bearer <your-api-key>',
  'Accept': 'application/json'
}
conn.request("GET", "/api/v1/projects", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require "uri"
require "net/http"
 
url = URI("https://piracymeter.com/api/v1/projects")
 
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
 
request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer <your-api-key>"
request["Accept"] = "application/json"
 
response = https.request(request)
puts response.read_body
```

{% endtab %}
{% endtabs %}

### Authentication with API Key in Query String

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

```bash
curl --location 'https://piracymeter.com/api/v1/projects?key=<your-api-key>' \
--header 'Accept: application/json'

```

{% endtab %}

{% tab title="JavaScript (jQuery)" %}

```javascript
var settings = {
  "url": "https://piracymeter.com/api/v1/projects?key=<your-api-key>",
  "method": "GET",
  "headers": {
    "Accept": "application/json"
  },
};
 
$.ajax(settings).done(function (response) {
  console.log(response);
});

```

{% endtab %}

{% tab title="Node.js (Axios)" %}

```javascript
const axios = require('axios');
 
let config = {
  method: 'get',
  maxBodyLength: Infinity,
  url: 'https://piracymeter.com/api/v1/projects?key=<your-api-key>',
  headers: { 
    'Accept': 'application/json'
  }
};
 
axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});
```

{% endtab %}

{% tab title="PHP (Guzzle)" %}

```php
<?php
$client = new Client();
$headers = [
  'Accept' => 'application/json'
];
$request = new Request('GET', 'https://piracymeter.com/api/v1/projects?key=<your-api-key>', $headers);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();

```

{% endtab %}

{% tab title="PHP (cURL)" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://piracymeter.com/api/v1/projects?page=1&key=<your-api-key>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Accept: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

{% endtab %}

{% tab title="Python" %}

```python
import http.client

conn = http.client.HTTPSConnection("piracymeter.com")
payload = ''
headers = {
  'Accept': 'application/json'
}
conn.request("GET", "/api/v1/projects?key=<your-api-key>", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require "uri"
require "net/http"

url = URI("https://piracymeter.com/api/v1/projects?key=<your-api-key>")

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

request = Net::HTTP::Get.new(url)
request["Accept"] = "application/json"

response = https.request(request)
puts response.read_body

```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
Remember to replace`<your-api-key>` with your valid API key obtained from piracymeter.com.
{% endhint %}

## 4. Get Project List

`/projects` path

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

```bash
curl --location 'https://piracymeter.com/api/v1/projects' \
--header 'Authorization: Bearer <your-api-key>' \
--header 'Accept: application/json'
```

{% endtab %}

{% tab title="JavaScript (jQuery)" %}

```javascript
var settings = {
  "url": "https://piracymeter.com/api/v1/projects",
  "method": "GET",
  "headers": {
    "Authorization": "Bearer <your-api-key>",
    "Accept": "application/json"
  },
};
 
$.ajax(settings).done(function (response) {
  console.log(response);
});
```

{% endtab %}

{% tab title="Node.js (Axios)" %}

```javascript
const axios = require('axios');
 
let config = {
  method: 'get',
  maxBodyLength: Infinity,
  url: 'https://piracymeter.com/api/v1/projects',
  headers: { 
    'Authorization': '<your-api-key>', 
    'Accept': 'application/json'
  }
};
 
axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});
 
```

{% endtab %}

{% tab title="PHP (Guzzle)" %}

```php
<?php
$client = new Client();
$headers = [
  'Authorization' => 'Bearer <your-api-key>',
  'Accept' => 'application/json'
];
$request = new Request('GET', 'https://piracymeter.com/api/v1/projects', $headers);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
 
```

{% endtab %}

{% tab title="PHP (cURL)" %}

```php
<?php
 
$curl = curl_init();
 
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://piracymeter.com/api/v1/projects',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer <your-api-key>',
    'Accept: application/json'
  ),
));
 
$response = curl_exec($curl);
 
curl_close($curl);
echo $response;
```

{% endtab %}

{% tab title="Python" %}

```python
import http.client
 
conn = http.client.HTTPSConnection("piracymeter.com")
payload = ''
headers = {
  'Authorization': 'Bearer <your-api-key>',
  'Accept': 'application/json'
}
conn.request("GET", "/api/v1/projects", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require "uri"
require "net/http"
 
url = URI("https://piracymeter.com/api/v1/projects")
 
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
 
request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer <your-api-key>"
request["Accept"] = "application/json"
 
response = https.request(request)
puts response.read_body
 
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
Remember to replace`<your-api-key>` with your valid API key obtained from piracymeter.com.
{% endhint %}

## 5. Get Project URLs

To retrieve the URLs for a specific project, you can make a GET request to the following endpoint:

```bash
GET /api/v1/links
```

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

```bash
curl --location 'https://piracymeter.com/api/v1/links?project_id=<project_id>' \
--header 'Authorization: Bearer <your-api-key>' \
--header 'Accept: application/json'
```

{% endtab %}

{% tab title="JavaScript (jQuery)" %}

```java
var settings = {
  "url": "https://piracymeter.com/api/v1/links?project_id=<project_id>",
  "method": "GET",
  "timeout": 0,
  "headers": {
    "Authorization": "Bearer <your-api-key>",
    "Accept": "application/json"
  },
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

{% endtab %}

{% tab title="Node.js (Axios)" %}

```java
const axios = require('axios');

let config = {
  method: 'get',
  maxBodyLength: Infinity,
  url: 'https://piracymeter.com/api/v1/links?project_id=<project_id>',
  headers: { 
    'Authorization': 'Bearer <your-api-key>', 
    'Accept': 'application/json'
  }
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

```

{% endtab %}

{% tab title="PHP (Guzzle)" %}

```php
<?php
$client = new Client();
$headers = [
  'Authorization' => 'Bearer <your-api-key>',
  'Accept' => 'application/json'
];
$request = new Request('GET', 'https://piracymeter.com/api/v1/links?project_id=<project_id>', $headers);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();

```

{% endtab %}

{% tab title="PHP (cURL)" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://piracymeter.com/api/v1/links?project_id=<project_id>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer <your-api-key>',
    'Accept: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

{% endtab %}

{% tab title="Python" %}

```python
import http.client

conn = http.client.HTTPSConnection("piracymeter.com")
payload = ''
headers = {
  'Authorization': 'Bearer <your-api-key>',
  'Accept': 'application/json'
}
conn.request("GET", "/api/v1/links?project_id=<project_id>", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require "uri"
require "net/http"

url = URI("https://piracymeter.com/api/v1/links?project_id=<project_id>")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer <your-api-key>"
request["Accept"] = "application/json"

response = https.request(request)
puts response.read_body
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
Remember to replace `<project_id>` in the endpoint URL with the actual ID of the project you want to retrieve the URLs for, and `<your-api-key>` with your valid API key obtained from piracymeter.com.
{% endhint %}

## 6. Pagination

The PiracyMeter API supports pagination for retrieving large sets of data. The response from the API includes information about the available pages and the ability to navigate between them.

The following query parameters can be used for pagination:

* `page` (optional): The page number to retrieve. Default is 1.

The response will include the following pagination information:

* `current_page`: The current page number.
* `per_page`: The number of results per page.

Example response:

```json
{
    "status": "success",
    "data": {
        "links": {
            "current_page": 1,
            "per_page": 100,
            "data": [
                // Results for the current page
            ]
        }
    }    
}

```

To navigate between pages, you can modify the `page` query parameter in your API request. For example, to retrieve the second page of results, you can use the following URL:

```bash
GET /api/v1/projects?page=2
```

{% hint style="warning" %}
Remember to include the appropriate authentication headers (`Authorization` and `Accept`) in your API requests.&#x20;
{% endhint %}

Please note that API may impose rate limits or other restrictions to ensure fair usage.

## 7. Error Handling

The PiracyMeter API uses standard HTTP status codes to indicate the success or failure of a request. In case of an error, additional information may be provided in the response body.

Here are some common HTTP status codes you may encounter:

* 200 OK: The request was successful, and the response body contains the requested data.
* 400 Bad Request: The request was invalid or could not be understood. Check your request parameters and format.
* 401 Unauthorized: The request lacks valid authentication credentials or the provided API key is invalid.
* 403 Forbidden: The request is valid, but the server is refusing to respond. Ensure you have the necessary permissions.
* 404 Not Found: The requested resource was not found. Verify the endpoint URL and resource identifiers.
* 429 Too Many Requests: The request exceeds the rate limits. Retry the request after a certain period.
* 500 Internal Server Error: An unexpected error occurred on the server. Contact the PiracyMeter support team if the issue persists.

Example error response:

```json
{
    "status": "error",
    "error": {
        "code": 403,
        "text": "Not authorized."
    }
}
```

{% hint style="info" %}
Ensure that your API client handles different status codes appropriately and displays or logs any error messages returned by the API.
{% endhint %}

## 8. Rate Limiting

The PiracyMeter API enforces rate limiting to ensure fair usage. The current rate limit is set to 100 requests per minute per API key. If you exceed this limit, you will receive a `429 Too Many Requests` response.


---

# 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.piracymeter.com/developers/api-documentation.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.
