# Quick Start

## Get your API keys

Your API requests are authenticated using API keys. Any request that doesn't include an API key will return an error.

You can generate an API key on <https://pay.imal.dev/register.html>

## Make your first invoice

To make your first request, send an authenticated request to the createTransaction endpoint. This will create a transaction.

## Create a new transaction

<mark style="color:green;">`POST`</mark> `https://pay.imal.dev/api/createTransaction`

Creates a new transaction.

#### Request Body

| Name                                          | Type   | Description                                                                                            |
| --------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------ |
| key<mark style="color:red;">\*</mark>         | string | Your merchant API key.                                                                                 |
| description<mark style="color:red;">\*</mark> | string | Description of the transaction (eg. Invoice #63729)                                                    |
| tokenid<mark style="color:red;">\*</mark>     | string | tti\_ of the vite token used for the transaction                                                       |
| amount<mark style="color:red;">\*</mark>      | String | RAW Amount of the token used for the transaction                                                       |
| memoprefix                                    | String | Prefix for the memo used in the transaction (eg. "gifts" would result in something like "gifts823729") |
| destination<mark style="color:red;">\*</mark> | String | Address the funds should be sent to.                                                                   |
| redirecturl<mark style="color:red;">\*</mark> | String | "Back to merchant" URL                                                                                 |

{% tabs %}
{% tab title="200 Transaction successfully created" %}

```javascript
{
  "code": 1,
  "id": "927192719",
  "expires": "192019281",
  "url": "https://pay.imal.dev/pay/82837829"
}
```

{% endtab %}

{% tab title="400: Bad Request memoPrefix too long" %}

```javascript
{
  "code": 2
}
```

{% endtab %}

{% tab title="400: Bad Request Invalid TokenID" %}

```javascript
{
  "code": 3
}
```

{% endtab %}

{% tab title="400: Bad Request Incorrect destination address" %}

```javascript
{
  "code": 4
}
```

{% endtab %}

{% tab title="400: Bad Request Amount is NaN (Not a number)" %}

```javascript
{
  "code": 5
}
```

{% endtab %}

{% tab title="400: Bad Request Redirect URL invalid or empty." %}

```javascript
{
  "code": 7
}
```

{% endtab %}

{% tab title="400: Bad Request Description too long (max. 75 characters)" %}

```javascript
{
  "code": 6
}
```

{% endtab %}

{% tab title="401: Unauthorized Invalid API Key" %}

```javascript
{
  "code": 8
}
```

{% endtab %}

{% tab title="500: Internal Server Error SQL/Server Error" %}

```javascript
{
  "code": 500
}
```

{% endtab %}
{% endtabs %}

Take a look at how you might call this method using `curl`:

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

```
curl --location --request POST 'https://pay.imal.dev/api/createTransaction' \
--header 'Content-Type: application/json' \
--data-raw '{
    "key": "AFJIOAs98ksks9",
    "description": "Invoice #92828",
    "tokenid": "tti_5649544520544f4b454e6e40",
    "amount": "100000000000000000000",
    "memoprefix": "gifts",
    "destination": "vite_2ff6ffebcf03638b20072c9b40a49778e894420ddf58e40df5",
    "redirecturl": "https://example.com"
}'
```

{% 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.pay.imal.dev/quick-start.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.
