# Short Urls

## Create a short url

<mark style="color:green;">`POST`</mark> `https://api.8pay.network/v1/:chain/one-time/short-urls`

#### Path Parameters

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

#### Headers

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

#### Request Body

| Name                                | Type    | Description                                                                                  |
| ----------------------------------- | ------- | -------------------------------------------------------------------------------------------- |
| name                                | string  | short url's name                                                                             |
| params                              | object  | object containing short url parameters                                                       |
| params.description                  | string  | payment's description                                                                        |
| params.receivers                    | array   | array of ethereum addresses                                                                  |
| params.amounts                      | array   | array of amounts to send to the respective receivers                                         |
| params.token                        | string  | erc20 token symbol, see Tokens                                                               |
| params.category                     | string  | category of the service/product, see Categories                                              |
| params.tag                          | string  | label used for identification or classification *(max 32 bytes)*                             |
| params.callbackSuccess              | string  | redirect url after success                                                                   |
| params.callbackError                | string  | redirect url after failure                                                                   |
| params.webhook                      | string  | url for server-side notification                                                             |
| params.extra                        | object  | extra parameters to be sent to webhook                                                       |
| params.chargeReceiversForServiceFee | boolean | when set to true receivers will be charged for service fee instead of sender (default false) |

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

```
{
    "path": "outwE",
    "name": "Ebook",
    "createdAt": 1574954504,
    "updatedAt": 1574954504,
    "params": {
        "description": "Ebook",
        "receivers": ["0xe42fD8a58A82fDF624A8a94dA03a0e44F9934Dff"],
        "amounts": ["5"],
        "token": "8PAY",
        "category": "Shop",
        "tag": "ebook_859294",
        "chargeReceiversForServiceFee": false,
        "callbackSuccess": "https://yoursite.com/thankyou",
        "callbackError": "https://yoursite.com/error",
        "webhook": "https://yoursite.com/notifications",
        "extra": {
            "banner": "BR69",
            "traffic": "facebook"
        }
    },
    "link": "https://8pay.me/outwE"
}
```

{% endtab %}
{% endtabs %}

## Get a list of short urls

<mark style="color:blue;">`GET`</mark> `https://api.8pay.network/v1/:chain/one-time/short-urls`

Retrive a list of short url created by the authenticated user.

#### Path Parameters

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

#### Headers

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

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

```
{
    "data": [
        {
            "path": "outwE",
            "name": "Ebook",
            "createdAt": 1574954504,
            "updatedAt": 1574954504,
            "params": {
                "description": "Ebook",
                "receivers": ["0xe42fD8a58A82fDF624A8a94dA03a0e44F9934Dff"],
                "amounts": ["5"],
                "token": "8PAY",
                "category": "Shop",
                "tag": "ebook_859294",
                "chargeReceiversForServiceFee": false,
                "callbackSuccess": "https://yoursite.com/thankyou",
                "callbackError": "https://yoursite.com/error",
                "webhook": "https://yoursite.com/notifications",
                "extra": {
                    "banner": "BR69",
                    "traffic": "facebook"
                }
            },
            "link": "https://8pay.me/outwE"
        }
    ],
    "limit": 100,
    "offset": 0,
    "total": 1
}
```

{% endtab %}
{% endtabs %}

## Get a short-url

<mark style="color:blue;">`GET`</mark> `https://api.8pay.network/v1/:chain/one-time/short-urls/:path`

Retrive a short url created by the authenticated user.

#### Path Parameters

| Name  | Type   | Description                                 |
| ----- | ------ | ------------------------------------------- |
| path  | string | path of the short url                       |
| chain | string | [chain identifier](/api/overview.md#chains) |

#### Headers

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

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

```
{
    "path": "outwE",
    "name": "Ebook",
    "createdAt": 1574954504,
    "updatedAt": 1574954504,
    "params": {
        "description": "Ebook",
        "receivers": ["0xe42fD8a58A82fDF624A8a94dA03a0e44F9934Dff"],
        "amounts": ["5"],
        "token": "8PAY",
        "category": "Shop",
        "tag": "ebook_859294",
        "chargeReceiversForServiceFee": false,
        "callbackSuccess": "https://yoursite.com/thankyou",
        "callbackError": "https://yoursite.com/error",
        "webhook": "https://yoursite.com/notifications",
        "extra": {
            "banner": "BR69",
            "traffic": "facebook"
        }
    },
    "link": "https://8pay.me/outwE"
}
```

{% endtab %}
{% endtabs %}

## Update a short url

<mark style="color:orange;">`PUT`</mark> `https://api.8pay.network/v1/:chain/one-time/short-urls/:path`

#### Path Parameters

| Name  | Type   | Description                                 |
| ----- | ------ | ------------------------------------------- |
| path  | string | path of the short url                       |
| chain | string | [chain identifier](/api/overview.md#chains) |

#### Headers

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

#### Request Body

| Name                                | Type    | Description                                                                                  |
| ----------------------------------- | ------- | -------------------------------------------------------------------------------------------- |
| name                                | string  | short url’s name                                                                             |
| params                              | string  | object containing short url parameters                                                       |
| params.description                  | string  | payment's description                                                                        |
| params.receivers                    | array   | array of ethereum addresses                                                                  |
| params.amounts                      | array   | array of amounts to send to the respective receivers                                         |
| params.token                        | string  | erc20 token symbol                                                                           |
| params.category                     | string  | category of the service/product, see categories                                              |
| params.tag                          | string  | label used for identification or classification *(max 32 bytes)*                             |
| params.callbackSuccess              | string  | redirect url after success                                                                   |
| params.callbackError                | string  | redirect url after failure                                                                   |
| params.webhook                      | string  | url for server-side notification                                                             |
| params.extra                        | string  | extra parameters to be sent to webhook                                                       |
| params.chargeReceiversForServiceFee | boolean | when set to true receivers will be charged for service fee instead of sender (default false) |

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

```
{
    "path": "outwE",
    "name": "Ebook",
    "createdAt": 1574954504,
    "updatedAt": 1574973485,
    "params": {
        "description": "Ebook",
        "receivers": ["0xe42fD8a58A82fDF624A8a94dA03a0e44F9934Dff"],
        "amounts": ["5"],
        "token": "8PAY",
        "description": "Ebook",
        "category": "Shop",
        "tag": "ebook_859294",
        "chargeReceiversForServiceFee": false,
        "webhook": "https://yoursite.com/notifications",
        "extra": {
            "banner": "BR69",
            "traffic": "facebook"
        }
    },
    "link": "https://8pay.me/outwE"
}
```

{% endtab %}
{% endtabs %}

## Delete a short-url

<mark style="color:red;">`DELETE`</mark> `https://api.8pay.network/v1/:chain/one-time/short-urls/:path`

Delete a short url created by the authenticated user.

#### Path Parameters

| Name  | Type   | Description                                 |
| ----- | ------ | ------------------------------------------- |
| path  | string | path of the short url                       |
| chain | string | [chain identifier](/api/overview.md#chains) |

#### Headers

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

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

```
```

{% 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/one-time/short-urls.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.
