Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions access-token-authorization/access-token-authorization.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: "Access Token Authorization"
---

Access tokens generated on the platform are critical for securely authenticating API requests. These tokens grant access to specific resources or actions, as defined by the permissions assigned to them.

For security reasons, the platform **does not store the token itself**. Instead, it maintains metadata associated with the token, such as its name, creation date, and expiration date, ensuring secure token management.

**Access Token Utilization**

Access tokens can be used to authorize interactions with the platform’s APIs in a secure and streamlined manner. The following header must be included in API requests to authenticate them:

```text
Authorization: Bearer {accessToken}
```

This ensures that:

- Only authorized users or applications can access the specified API resources.
- All API requests are securely authenticated and aligned with the token's permissions.
111 changes: 87 additions & 24 deletions access-token-authorization/cloud-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@
title: "Cloud Api"
---

## Cloud API

Manage Cloud nodes over a REST JSON API.

## Base URL

```text
https://cloud-api.thunderstack.org
```
`[https://cloud-api.thunderstack.org]`

## Authentication

Expand All @@ -26,7 +22,9 @@ Each request must include:
-H "Authorization: Bearer ${CLOUD_API_TOKEN}"
```

Examples below use `curl` and show paths relative to the base URL.
<Info>
Examples below use `curl` and show paths relative to the base URL.
</Info>

## List nodes

Expand Down Expand Up @@ -61,23 +59,44 @@ Example response:

## Create a node

`POST /api/nodes`
**POST** `/api/nodes`

Body fields: `name` (string, required), `network` (string, required): regtest or testnet, `settings` (object, optional): webhookUrl
Body fields:

- `name` (string, required)
- `network` (string, required): `regtest` or `testnet`
- `settings` (object, optional)
- webhookUrl (string, optional)

```text
curl -s \
-H "Authorization: Bearer ${CLOUD_API_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"name":"my-node","network":"regtest","settings":{"webhookUrl":"https://example.com/webhooks/thunderstack"}}' \
-d '{
"name":"my-node",
"network":"regtest",
"settings":{"webhookUrl":"https://example.com/webhooks/thunderstack"}
}' \
"https://cloud-api.thunderstack.org/api/nodes"
```

Example response: `{ "data": { "nodeId": "<node_id>", "name": "my-node", "network": "regtest", "status": "STARTING" }, "message": "<message>" }`
Example response:

```text
{
"data": {
"nodeId": "<node_id>",
"name": "my-node",
"network": "regtest",
"status": "STARTING"
},
"message": "<message>"
}
```

## Get a node

`GET /api/nodes/{id}`
**GET** `/api/nodes/{id}`

```text
curl -s \
Expand All @@ -87,7 +106,13 @@ curl -s \

## Destroy a node

`DELETE /api/nodes` — Body: `destroyNodeId` (string, required). This endpoint expects a JSON body on a DELETE request.
DELETE `/api/nodes`

Body: `destroyNodeId` (string, required).

<Warning>
This endpoint expects a JSON body on a DELETE request.
</Warning>

```text
curl -s -X DELETE \
Expand All @@ -97,43 +122,65 @@ curl -s -X DELETE \
"https://cloud-api.thunderstack.org/api/nodes"
```

Example response:

```text
{ "message": "<message>" }
```

## Webhooks: public key

`GET /api/webhook-public-key` — Returns the public key used to verify webhook signatures.
**GET** `/api/webhook-public-key` — Returns the public key used to verify webhook signatures.

```text
curl -s \
-H "Authorization: Bearer ${CLOUD_API_TOKEN}" \
"https://cloud-api.thunderstack.org/api/webhook-public-key"
```

Example response: `{ "data": "<public_key>" }`
Example response:

```text
{ "data": "<public_key>" }
```

## RLN images: latest version

`GET /api/nodes/latest-rln-image`
**GET** `/api/nodes/latest-rln-image`

```text
curl -s \
-H "Authorization: Bearer ${CLOUD_API_TOKEN}" \
"https://cloud-api.thunderstack.org/api/nodes/latest-rln-image"
```

Example response: `{ "data": "<rln_version>" }`
Example response:

```text
{ "data": "<rln_version>" }
```

## RLN images: upgrade node

`POST /api/nodes/{id}/upgrade`
**POST** `/api/nodes/{id}/upgrade`

```text
curl -s -X POST \
-H "Authorization: Bearer ${CLOUD_API_TOKEN}" \
"https://cloud-api.thunderstack.org/api/nodes/<node_id>/upgrade"
```

Example response:

```text
{ "message": "<message>" }
```

## Node settings: update

`POST /api/nodes/{id}/settings` — Use this to change node settings like `webhookUrl`.
**POST** `/api/nodes/{id}/settings`

Use this to change node settings like `webhookUrl`.

```text
curl -s -X POST \
Expand All @@ -143,9 +190,15 @@ curl -s -X POST \
"https://cloud-api.thunderstack.org/api/nodes/<node_id>/settings"
```

Example response:

```text
{ "message": "<message>" }
```

## Node lifecycle: start

`POST /api/nodes/{id}/start`
**POST** `/api/nodes/{id}/start`

```text
curl -s -X POST \
Expand All @@ -155,7 +208,7 @@ curl -s -X POST \

## Node lifecycle: stop

`POST /api/nodes/{id}/stop`
**POST** `/api/nodes/{id}/stop`

```text
curl -s -X POST \
Expand All @@ -165,24 +218,34 @@ curl -s -X POST \

## Logs: trigger export

`POST /api/nodes/{id}/logs` — Starts a log export job for a node.
**POST** `/api/nodes/{id}/logs`

Starts a log export job for a node.

```text
curl -s -X POST \
-H "Authorization: Bearer ${CLOUD_API_TOKEN}" \
"https://cloud-api.thunderstack.org/api/nodes/<node_id>/logs"
```

Example response: `{ "taskId": "<task_id>" }`
Example response:

```text
{ "taskId": "<task_id>" }
```

## Logs: get download URLs

`GET /api/nodes/{id}/logs?taskId={taskId}`
GET `/api/nodes/{id}/logs?taskId={taskId}`

```text
curl -s \
-H "Authorization: Bearer ${CLOUD_API_TOKEN}" \
"https://cloud-api.thunderstack.org/api/nodes/<node_id>/logs?taskId=<task_id>"
```

Example response: `{ "data": ["<presigned_url>"] }`
Example response:

```text
{ "data": ["<presigned_url>"] }
```
37 changes: 29 additions & 8 deletions access-token-authorization/create-api-token.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,32 @@
title: "Create API Token"
---

1. **Navigate to the API Tokens page and create an access token**
Go to the API Tokens page and choose "Create Access Token".
2. **Provide a token name**
Input a name for the token. This helps manage multiple tokens.
3. **Revoking a token**
Tokens on this platform do not expire. They remain valid until manually revoked.
- To revoke an access token, return to the API Tokens section, find the token item, and click the **"Revoke"** button for that token.
- Revoking a token immediately deactivates it and prevents any further API access using that token.
<Steps>
<Step title="Navigate to the API Tokens page and create an access token" titleSize="h3">
Go to the API Tokens page and choose "Create Access Token".

<Frame caption="Create access token">
![Image](/images/image-16.png)
</Frame>
</Step>
<Step title="Provide a token name" titleSize="h3">
Input a name for the token. This helps manage multiple tokens.
</Step>
<Step title="Revoking a token" titleSize="h3">
<Warning>
Tokens on this platform do not expire. They remain valid until manually revoked.
</Warning>

- To revoke an access token, return to the API Tokens section, find the token item, and click the **"Revoke"** button for that token.

- Revoking a token immediately deactivates it and prevents any further API access using that token.

<Frame caption="Revoke token">
![Image](/images/image-17.png)
</Frame>
</Step>
</Steps>




Loading