# Plans

Plans define the minimum allowance, token and reset period for subscriptions to on-demand services and products. You can create a plan using the web app or directly interacting with our smart contracts.

## Get a list of plans

<mark style="color:blue;">`GET`</mark> `https://api.8pay.network/v1/:chain/on-demand/plans`

#### Path Parameters

| Name  | Type   | Description                                 |
| ----- | ------ | ------------------------------------------- |
| chain | string | [chain identifier](/api/overview.md#chains) |

#### Query Parameters

| Name     | Type   | Description                                                 |
| -------- | ------ | ----------------------------------------------------------- |
| admin    | string | filter by admin                                             |
| receiver | string | filter by receiver                                          |
| from     | number | filter by `createdAt` (default 0)                           |
| to       | number | filter by `createdAt` (default current timestamp)           |
| sort     | string | `asc` or `desc` (default `desc`), sort based on `createdAt` |

#### Headers

| Name          | Type   | Description       |
| ------------- | ------ | ----------------- |
| Authorization | string | Bearer \<api-key> |

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

```
{
    "data": [
        {
            "id": "0x57b2059e526841b3dfd964144513359c9fcfd6d91040b6c47f589c1e032b6bf7",
            "name": "CarBook",
            "admin": "0xe42fD8a58A82fDF624A8a94dA03a0e44F9934Dff",
            "minAllowance": 10,
            "token": "8PAY",
            "period": 2592000,
            "receiver": "0xe42fD8a58A82fDF624A8a94dA03a0e44F9934Dff",
            "category": "Rents",
            "createdAt": 1575107256,
            "transactionHash": "0x54587230024701c54878c32ca0951c070666f2afccec09ddc1d6921d584cca3c",
            "transactionStatus": "confirmed"
        }
    ],
    "limit": 100,
    "offset": 0,
    "total": 1
}
```

{% endtab %}
{% endtabs %}

## Get a plan

<mark style="color:blue;">`GET`</mark> `https://api.8pay.network/v1/:chain/on-demand/plans/:planId`

#### Path Parameters

| Name   | Type   | Description                                 |
| ------ | ------ | ------------------------------------------- |
| planId | string | ID of the plan                              |
| chain  | string | [chain identifier](/api/overview.md#chains) |

#### Headers

| Name          | Type   | Description       |
| ------------- | ------ | ----------------- |
| Authorization | string | Bearer \<api-key> |

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

```
{
    "id": "0x57b2059e526841b3dfd964144513359c9fcfd6d91040b6c47f589c1e032b6bf7",
    "name": "CarBook",
    "admin": "0xe42fD8a58A82fDF624A8a94dA03a0e44F9934Dff",
    "minAllowance": 10,
    "token": "8PAY",
    "period": 2592000,
    "receiver": "0xe42fD8a58A82fDF624A8a94dA03a0e44F9934Dff",
    "category": "Rents",
    "createdAt": 1575107256,
    "transactionHash": "0x54587230024701c54878c32ca0951c070666f2afccec09ddc1d6921d584cca3c",
    "transactionStatus": "confirmed"
}
```

{% endtab %}
{% endtabs %}


---

# 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.8pay.network/api/on-demand/plans.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.
