> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.perkss.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.perkss.io/_mcp/server.

# Get the primary chart series

GET https://api-gateway.perkss.io/api/v1/statistics/graph

Program-aware chart payload over an inclusive local-day range (`from`/`to`, YYYY-MM-DD, Europe/Madrid days). Cashback programs return a zero-filled daily revenue series plus the range total; stamps programs return the fixed five visit-frequency buckets (lifetime — the range is ignored for stamps). Switch on the `programType` discriminator.

Reference: https://docs.perkss.io/api-reference/perkss-partner-api/statistics/graph

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Query parameters

- `from` (string, required) — Inclusive range start, local day (Europe/Madrid), YYYY-MM-DD.
- `to` (string, required) — Inclusive range end, local day (Europe/Madrid), YYYY-MM-DD.

## Response

### 200

Program-aware chart payload — switch on `programType`.

- `Statistics_graph_Response_200`
  - `programType`: `cashback` (cashback)
    - `points` (list of RevenuePoint, required) — Daily revenue over the requested range, zero-filled — one point per local day.
    - `totalCents` (double, required) — Revenue total across the range, in cents.
  - `programType`: `stamps` (stamps)
    - `buckets` (list of VisitBucket, required) — The fixed five visit-frequency buckets (lifetime visits, not range-scoped).

## Errors

### 400 Bad Request Error

Invalid query. Code: `VALIDATION.REQUEST_INVALID` (`from`/`to` must be YYYY-MM-DD).

- `error` (ErrorBody, required)

### 401 Unauthorized Error

Missing, invalid, expired, or revoked access token. Codes: `AUTH.MISSING_BEARER_TOKEN`, `AUTH.INVALID_TOKEN`, `API_AUTH.TOKEN_REVOKED`. Obtain a fresh token at `POST /api/v1/auth/token`.

- `error` (ErrorBody, required)

### 429 Too Many Requests Error

`RATE_LIMIT.EXCEEDED` — reads 600/min per API key (default). Honour `Retry-After` before retrying.

- `error` (ErrorBody, required)

### 503 Service Unavailable Error

`API_AUTH.DENYLIST_UNAVAILABLE` — transient auth-infrastructure outage; retry after `Retry-After` seconds.

- `error` (ErrorBody, required)

## Types

### RevenuePoint

- `date` (string, required) — Local day (Europe/Madrid), YYYY-MM-DD.
- `amountCents` (double, required) — Recorded purchase revenue for the day, in cents.

### VisitBucket

- `visits` (enum, required) — Visit-count bucket.
  - Allowed values: `1`, `2`, `3`, `4`, `5+`
- `customers` (double, required) — Customers whose lifetime visits fall in this bucket.

### ErrorBody

- `code` (string, required) — Machine-readable code, namespaced `<DOMAIN>.<NAME>`. Stable: branch on this, never on `message`.
- `message` (string, required) — Human-readable explanation. Not stable across releases — never branch on it.
- `requestId` (string, required) — Correlation id for this request — quote it when contacting support.
- `httpStatus` (double, required) — The response's HTTP status, mirrored into the body.
- `context` (map from string to any, optional) — Optional structured detail — e.g. `validation` messages on a 400, `failureReason` on a 422 rejected write.

## Examples

### Cashback program

**Response**

```json
{
  "programType": "cashback",
  "points": [
    {
      "date": "2026-07-01",
      "amountCents": 12550
    },
    {
      "date": "2026-07-02",
      "amountCents": 0
    },
    {
      "date": "2026-07-03",
      "amountCents": 8900
    }
  ],
  "totalCents": 21450
}
```

**SDK Code**

```python Cashback program
import requests

url = "https://api-gateway.perkss.io/api/v1/statistics/graph"

querystring = {"from":"2026-01-01","to":"2026-03-31"}

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```javascript Cashback program
const url = 'https://api-gateway.perkss.io/api/v1/statistics/graph?from=2026-01-01&to=2026-03-31';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Cashback program
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api-gateway.perkss.io/api/v1/statistics/graph?from=2026-01-01&to=2026-03-31"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Cashback program
require 'uri'
require 'net/http'

url = URI("https://api-gateway.perkss.io/api/v1/statistics/graph?from=2026-01-01&to=2026-03-31")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

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

```java Cashback program
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api-gateway.perkss.io/api/v1/statistics/graph?from=2026-01-01&to=2026-03-31")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php Cashback program
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api-gateway.perkss.io/api/v1/statistics/graph?from=2026-01-01&to=2026-03-31', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp Cashback program
using RestSharp;

var client = new RestClient("https://api-gateway.perkss.io/api/v1/statistics/graph?from=2026-01-01&to=2026-03-31");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Cashback program
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api-gateway.perkss.io/api/v1/statistics/graph?from=2026-01-01&to=2026-03-31")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Stamps program

**Response**

```json
{
  "programType": "stamps",
  "buckets": [
    {
      "visits": "1",
      "customers": 40
    },
    {
      "visits": "2",
      "customers": 21
    },
    {
      "visits": "3",
      "customers": 9
    },
    {
      "visits": "4",
      "customers": 5
    },
    {
      "visits": "5+",
      "customers": 12
    }
  ]
}
```

**SDK Code**

```python Stamps program
import requests

url = "https://api-gateway.perkss.io/api/v1/statistics/graph"

querystring = {"from":"2026-01-01","to":"2026-03-31"}

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```javascript Stamps program
const url = 'https://api-gateway.perkss.io/api/v1/statistics/graph?from=2026-01-01&to=2026-03-31';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Stamps program
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api-gateway.perkss.io/api/v1/statistics/graph?from=2026-01-01&to=2026-03-31"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Stamps program
require 'uri'
require 'net/http'

url = URI("https://api-gateway.perkss.io/api/v1/statistics/graph?from=2026-01-01&to=2026-03-31")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

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

```java Stamps program
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api-gateway.perkss.io/api/v1/statistics/graph?from=2026-01-01&to=2026-03-31")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php Stamps program
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api-gateway.perkss.io/api/v1/statistics/graph?from=2026-01-01&to=2026-03-31', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp Stamps program
using RestSharp;

var client = new RestClient("https://api-gateway.perkss.io/api/v1/statistics/graph?from=2026-01-01&to=2026-03-31");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Stamps program
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api-gateway.perkss.io/api/v1/statistics/graph?from=2026-01-01&to=2026-03-31")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```