# About

## Tutorial

The following is an example of how to get a public random hex value.

### Authentication

Make sure you provide an[ API in the header](/cryptosat/api-documentation/authentication.md).

### Get public randomness

Send the following request:

**GET** `{{api-url}}/public/randomness/results`

You should get the following similar response:

```json
{
    "statusCode": 200,
    "body": {
        "request": {
            "request_uuid": "c6f9c441-446d-4d07-bc11-1b5d868bb942",
            "request_name": "pub_rand",
            "request_verb": "GET",
            "request_status": {
                "status_code": 0,
                "request_status": "PENDING"
            },
            "response_eta": "2022-12-30 14:21:14",
            "created_at": "2022-12-30 10:21:14",
            "satellite_id": "crypto1"
        }
    }
}
```

Note that the `status_name` is [`PENDING`](/cryptosat/api-documentation/queue-api/api-reference/queue.md). This is because the command has not yet been sent to the satellite and is queued for the next visibility window indicated by `response_eta`.

You can check the status by using the `request_uuid` obtained from the store command to check if it has been sent off:

**GET** `{{api-url}}/queue/request?=request_id=c6f9c441-446d-4d07-bc11-1b5d868bb942`

You should get the following response:

<pre class="language-json"><code class="lang-json"><strong>{
</strong>    "request": {
        "request_uuid": "c6f9c441-446d-4d07-bc11-1b5d868bb942",
        "request_name": "pub_rand",
        "request_verb": "GET",
        "request_status": {
            "request_status": "PENDING",
            "status_code": "0"
        },
        "created_at": "2022-12-30 10:21:14",
        "response_eta": "2022-12-30 14:21:14",
        "satellite_id": "crypto1"
    },
    "response_payload": {}
}
</code></pre>

When the request status has changed to SENT, it can no longer be deleted. Once it is READY, the `response_payload` will be populated and the command can be archived.&#x20;

You should get the following response or similar once when the request status is READY:

```json
{
    "request": {
        "request_uuid": "c6f9c441-446d-4d07-bc11-1b5d868bb942",
        "request_name": "private_key",
        "request_verb": "POST",
        "request_status": {
            "request_status": "PENDING",
            "status_code": "2"
        },
        "created_at": "2022-12-30 10:21:14",
        "response_eta": "",
        "satellite_id": "crypto1"
    },
    "response_payload": {
        "payload_size": 33,
        "received_at": "2022-12-30 10:21:14",
        "payload": {
              "randomness": "7c6929685dbd9eb6ae505074e80f9b91eb2a32f15fad935c148f84f679de1822"
        },
        "signature": "3045022100a180999e556d151b5ca978977ca42b1f2aa0f47d38af208887444f971b4a79170220663b3ba622454ed06fb233daf1586ff3de4b1429932a5993d18ac5d11a28219f",
        "is_verified": true
    }
}
```


---

# 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.cryptosat.io/cryptosat/api-documentation/public-randomness-sapi/about.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.
