# Introduzione

## Base path

Tutte le chiamate vengono effettuate al medesimo endpoint base

```
https://public-api.timesafe.io
```

## Stati degli oggetti

Le API trattano di fatto 2 oggetti base: **utenti** e **certificati.** Ecco gli stati in cui questi oggetti possono trovarsi:

#### Stati User

| Stato             | Significato                                                                                             |
| ----------------- | ------------------------------------------------------------------------------------------------------- |
| USER\_NOT\_ACTIVE | Questa utenza esiste ma non può essere ancora usata.                                                    |
| USER\_READY       | Questa utenza è pronta a essere usata ma non ha un Token assegnato (utente non ha mai effettuato login) |
| USER\_LOGGED      | L'utente ha effettuato un login.                                                                        |
| USER\_SUSPENDED   | Utenza sospesa                                                                                          |
| USER\_DELETED     | Utenza eliminata definitivamente.                                                                       |

#### Stati Certificate

| Stato                | Significato                                                                                                                                                                                                                                                              |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| JUST\_CREATED        | Questo certificato è stato creato da un User                                                                                                                                                                                                                             |
| SENT\_TO\_BLOCKCHAIN | Questo certificato è stato inviato alla Blockchain, ed è in attesa di essere inserito in un pool di mining.                                                                                                                                                              |
| TRANSACTION\_CREATED | Il certificato è inserito in una transazione da un miner.                                                                                                                                                                                                                |
| BLOCK\_SECURED       | Il blocco di cui fa parte la transazione è stato aggiunto alla blockchain ed ha un numero di conferme sufficiente a considerarlo immutabile.                                                                                                                             |
| LOST\_IN\_FORK       | <p>La transazione di questo certificato è su un blocco che è finito in una fork non confermata della blockchain. Verrà rimesso automaticamente in stato SENT\_TO\_BLOCCHAIN per essere riprocessato.</p><p>È estremamente improbabile che questo stato si verifichi.</p> |

## Postman

Di seguito i file per testare le API tramite Postman e il file di environment relativo. Il file di environment va modificato (da Postman o da editor testuale), inserendo il proprio Token per effettuare le chiamate.

{% file src="<https://2444339270-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M7GkD_HxogJP-tyWq0l%2F-MRTx3-jqzS6AR5B32bu%2F-M8nf2CrJ61CYOKJeeFd%2FTimeSafe%20API%20Clienti.postman_collection.json?alt=media&token=dc3b4602-8493-440b-b377-bc02e77d8318>" %}
TimeSafe API Client.postman.collection.json
{% endfile %}

{% file src="<https://2444339270-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M7GkD_HxogJP-tyWq0l%2F-MRTx6Fy5COEEudEN2hr%2F-MRTxqXO5_JV6NZQvidy%2FTimeSafe%20Public%20API.postman_environment.json?alt=media&token=23b113a1-44e2-41f5-9387-7db4a38d5c68>" %}
TimeSafe Public API.postman\_environment.json
{% endfile %}

## Sandbox mode, Live mode

Le API pubbliche di Timesafe consentono l'utilizzo di una modalità sandbox\
Ogni untente ha a disposizione due credenziali, quelle di produzione (live mode) e quelle di test ( sandbox mode).\
Il funzionamento delle API è il medesimo, ma l'utenza Sandbox non salva le transazioni in blockchain e non esaurisce mai i crediti.\
Inoltre per gli utenti di tipo amministratore, in sandbox mode è impossibile creare nuove utenze (la chiamata ha successo ma restituisce dati mock-up)


---

# 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/master.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.
