# Credits

## Send credits

<mark style="color:green;">`POST`</mark> `https://public-api.timesafe.io/credits/send`

Questo servizio permette di inviare crediti dal proprio budget a quello di un altro utente, purché se ne abbia l'ID. Dato che il trasferimento di crediti è un'operazione on-chain, ha un costo (1 credito circa). Dunque bisogna tenere conto di questo costo come scarto tra crediti disponibili e crediti inviabili.&#x20;

#### Headers

| Name  | Type   | Description                              |
| ----- | ------ | ---------------------------------------- |
| token | string | Token JWT ottenuto da endpoint di login. |

#### Request Body

| Name    | Type    | Description                                           |
| ------- | ------- | ----------------------------------------------------- |
| user    | integer | ID dell'utente a cui si vogliono inviare crediti.     |
| credits | integer | Numero di crediti da inviare. Minimo 1, massimo 9999. |

{% tabs %}
{% tab title="200 Crediti inviati con successo" %}

```
{
    "status": "OK",
    "data": {
        "your_new_balance": 97,
        "user_new_balance": 2
    }
}
```

{% endtab %}

{% tab title="501 Problemi di invio" %}

```
// CREDITI INSUFFICIENTI
{
    "error": {
        "code": "5_topi_invalidi",
        "details": "You don't have enough credits to perform this action."
    }
}

// UTENTE NON ESISTENTE O PARTE DI ALTRA ORGANIZZAZIONE
{
    "error": {
        "code": "5_topi_invalidi",
        "details": "This user does not exists or you do not have the permission to use it."
    }
}
```

{% 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.public-api.timesafe.io/api/credits.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.
