Skip to content
Draft
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
26 changes: 10 additions & 16 deletions pages/billing/api-cli/retrieve-monthly-consumption.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ Open a terminal and run the following command to export your API secret key and
Run the following command to obtain your consumption over the current month.

```bash
curl -X GET \
-H "X-Auth-Token: $SCW_SECRET_KEY" \
-H "Content-Type: application/json" \
"https://api.scaleway.com/billing/v2beta1/consumptions?organization_id=$SCW_ORGANIZATION_ID"
scw billing consumption list \
--organization-id=$SCW_ORGANIZATION_ID
```

## Consumption of a product category
Expand All @@ -63,10 +61,9 @@ Run the following command to obtain your consumption over the current month for
- `Subscription`

```bash
curl -X GET \
-H "X-Auth-Token: $SCW_SECRET_KEY" \
-H "Content-Type: application/json" \
"https://api.scaleway.com/billing/v2beta1/consumptions?organization_id=$SCW_ORGANIZATION_ID&category_name=Compute"
scw billing consumption list \
--organization-id=$SCW_ORGANIZATION_ID \
--category-name=Compute
```

## Consumption of a specific month
Expand All @@ -76,10 +73,9 @@ Run the following command to obtain your consumption for a specific month.
Specify the target billing period as `YYYY-MM`, e.g. `2023-11`.

```bash
curl -X GET \
-H "X-Auth-Token: $SCW_SECRET_KEY" \
-H "Content-Type: application/json" \
"https://api.scaleway.com/billing/v2beta1/consumptions?organization_id=$SCW_ORGANIZATION_ID&billing_period=2023-11"
scw billing consumption list \
--organization-id=$SCW_ORGANIZATION_ID \
--billing-period=2023-11
```

## Consumption of a specific Project
Expand All @@ -95,8 +91,6 @@ Run the following command to obtain your consumption for a specific Project only
Then inject it in your API request:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Then inject it in your API request:
Then inject it in your Scaleway CLI request:


```bash
curl -X GET \
-H "X-Auth-Token: $SCW_SECRET_KEY" \
-H "Content-Type: application/json" \
"https://api.scaleway.com/billing/v2beta1/consumptions?project_id=SCW_PROJECT_ID"
scw billing consumption list \
--project-id=SCW_PROJECT_ID
```
42 changes: 21 additions & 21 deletions pages/iot-hub/api-cli/getting-started-with-iot-hub-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ tags: iot iot-hub io-hub-api api curl mqtt jq json
import Requirements from '@macros/iam/requirements.mdx'
Copy link
Contributor

@estellesoulard estellesoulard Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Github won't let me comment the lines 2 to 6: update mentions of API/curl to CLI



In this tutorial we will use the API through the well known utility [curl](https://curl.haxx.se/). This will show you how to create Hubs and Devices, as well as more advanced features of the Scaleway IoT Hub: Hub Events and Routes.
In this tutorial we will use the Scaleway CLI. This will show you how to create Hubs and Devices, as well as more advanced features of the Scaleway IoT Hub: Hub Events and Routes.

The API reference is here: [IoT API](https://www.scaleway.com/en/developers/api/iot-hub/)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link CLI doc?


Expand All @@ -17,7 +17,7 @@ The API reference is here: [IoT API](https://www.scaleway.com/en/developers/api/
- A Scaleway account logged into the [console](https://console.scaleway.com)
- [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization
- A valid [API key](/iam/how-to/create-api-keys/).
- Installed `curl`, `mosquitto-clients` (mqtt client), and `jq` (json parsing tool)
- Installed the Scaleway CLI, `mosquitto-clients` (mqtt client), and `jq` (json parsing tool)

You already set the `SCW_SECRET_KEY` variable above, now set the following variables from the same terminal on your local computer:

Expand All @@ -38,11 +38,10 @@ The Hub creation is done through a REST endpoint. To create a Hub, you will need
We will save the output to `hub.json` file:

```bash
curl -sS -H "X-Auth-Token: $SCW_SECRET_KEY" -d '{
"project_id": "'$SCW_DEFAULT_PROJECT_ID'",
"name": "my_first_hub",
"product_plan": "plan_dedicated"
}' $IOT_API/hubs > hub.json
scw iot hub create \
--name=my_first_hub \
--product-plan=plan_dedicated \
--region=fr-par > hub.json

jq < hub.json
```
Expand Down Expand Up @@ -74,7 +73,9 @@ jq < hub.json
We can poll the hub status until it is ready:

```bash
curl -sS -H "X-Auth-Token: $SCW_SECRET_KEY" $IOT_API/hubs/$(jq -r '.id' hub.json) | jq -r '.status'
scw iot hub get \
--hub-id=$(jq -r '.id' hub.json) \
--region=fr-par | jq -r '.status'
```

At some point, the status will switch to `ready`.
Expand All @@ -93,11 +94,11 @@ Now we need to create 2 devices. You need to provide:
We will save the response to a file so we can use the fields later.

```bash
curl -sS -H "X-Auth-Token: $SCW_SECRET_KEY" -d '{
"hub_id": "'$(jq -r '.id' hub.json)'",
"name": "my_first_device",
"allow_insecure": true
}' $IOT_API/devices > dev1.json
scw iot device create \
--hub-id=$(jq -r '.id' hub.json) \
--name=my_first_device \
--allow-insecure=true \
--region=fr-par > dev1.json

jq < dev1.json
```
Expand Down Expand Up @@ -139,11 +140,11 @@ jq < dev1.json
Let's now create a second device:

```bash
curl -sS -H "X-Auth-Token: $SCW_SECRET_KEY" -d '{
"hub_id": "'$(jq -r '.id' hub.json)'",
"name": "my_second_device",
"allow_insecure": true
}' $IOT_API/devices > dev2.json
scw iot device create \
--hub-id=$(jq -r '.id' hub.json) \
--name=my_second_device \
--allow-insecure=true \
--region=fr-par > dev2.json

jq < dev2.json
```
Expand Down Expand Up @@ -186,9 +187,8 @@ If you require security, you can also connect your device to the Hub using TLS m
First, download the IoT Hub's server CA:

```bash
curl -sS -O https://iot.s3.nl-ams.scw.cloud/certificates/fr-par/iot-hub-ca.pem
sha1sum iot-hub-ca.pem
# 13cf3e59ed52d4c4b6bc249e85539d5fd5d572fb iot-hub-ca.pem
# The certificate is automatically handled by the CLI
# No need to download it manually when using the Scaleway CLI
```

Now, extract the certificates from the device JSON files, so that the mosquitto clients may use them:
Expand Down
8 changes: 6 additions & 2 deletions pages/iot-hub/how-to/setup-use-rest-network.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,13 @@ The required headers are:
* `X-Secret`: The network secret that was given while creating the network on a hub.
* `X-Topic`: The topic that the message should be published on.

Following an example using [curl](https://curl.haxx.se/):
Following an example using the Scaleway CLI:
```
> curl -XPOST -H "X-Secret: <network-secret>" -H "X-Topic: <topic>" -d <payload> <network-endpoint>
> scw iot network send-message \
--secret=<network-secret> \
--topic=<topic> \
--payload=<payload> \
--endpoint=<network-endpoint>
```

Use the following values:
Expand Down
10 changes: 3 additions & 7 deletions pages/key-manager/api-cli/create-dek-api-cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,9 @@ An output similar to the following should display:

Paste the following command to create your data encryption key via the Key Manager API. Make sure that you replace the placeholder values with your own.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Paste the following command to create your data encryption key via the Key Manager API. Make sure that you replace the placeholder values with your own.
Paste the following command to create your data encryption key via the Scaleway CLI. Make sure that you replace the placeholder values with your own.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not commenting other occurrences in order not to spam to much, but there seems to be a few similar API mentions left that should be replaced with the CLI

```bash
curl --location 'https://api.scaleway.com/key-manager/v1alpha1/regions/fr-par/keys/<your_key_id>/generate-data-key' \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <your_secret_key>' \
--data '{
"algorithm": "aes_256_gcm"
}'
```
scw keymanager key generate-data-key <your_key_id> \
--algorithm=aes_256_gcm \
--region=fr-par

Key Manager also supports the `GenerateDataKey` request without a plaintext operation, which only returns an encrypted data encryption key.

Expand Down
27 changes: 15 additions & 12 deletions pages/transactional-email/api-cli/send-emails-with-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ This page shows you how to send a simple transactional email in `JSON` format to
2. Run the following command to retrieve your domain's ID, as you will need it in the next step. The output should return your domain's information.

```
curl -X GET \
-H "X-Auth-Token: $SCW_SECRET_KEY" \
"https://api.scaleway.com/transactional-email/v1alpha1/regions/fr-par/domains"
scw tem domain list \
--region=fr-par
```


3. Run the following command to ensure that your domain is verified:

```
curl -X GET "https://api.scaleway.com/transactional-email/v1alpha1/regions/$REGION/domains/<domain-id>" \
-H "X-Auth-Token: $SCW_SECRET_KEY"
scw tem domain get \
--domain-id=<domain-id> \
--region=$REGION
```

4. Copy the following template. Make sure that you replace the placeholder information with your own.
Expand Down Expand Up @@ -80,9 +80,13 @@ This page shows you how to send a simple transactional email in `JSON` format to
}
EOF

curl -X POST "https://api.scaleway.com/transactional-email/v1alpha1/regions/$REGION/emails" \
-H "X-Auth-Token: $SCW_SECRET_KEY" \
-d @mail.json
scw tem email create \
[email protected] \
[email protected] \
--subject="This is a subject" \
--text="This is a short sentence." \
--project-id=<Scaleway Project ID> \
--region=$REGION
```

5. Once you have added your own information to the template above, run it in your terminal. An output similar to the following should display:
Expand All @@ -94,10 +98,9 @@ This page shows you how to send a simple transactional email in `JSON` format to
6. Run the following command to check that your email has been sent. Make sure that you replace `$EMAIL_ID` with the ID of the email you retrieved in the output of the previous step.

```
curl --request GET \
--url https://api.scaleway.com/transactional-email/v1alpha1/regions/fr-par/emails/$EMAIL_ID \
--header 'X-Auth-Token: $SCW_SECRET_KEY'

scw tem email get \
--email-id=$EMAIL_ID \
--region=fr-par
```

You should get an output similar to the following:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,13 @@ You can set up webhooks for Scaleway Transactional Email and subscribe them to [

5. Create a Transactional Email Webhook via the Scaleway API. Replace `{{sns_arn_id}}` with the ARN identifier you copied earlier.
```bash
curl --request POST \
--url https://api.scaleway.com/transactional-email/v1alpha1/regions/fr-par/webhooks \
--header 'X-Auth-Token: {{token}}' \
--data '{
"domain_id": "{{domain_id}}",
"project_id": "{{project_id}}",
"name": "My webhook name",
"event_types": [
"email_delivered",
"email_dropped"
],
"sns_arn": "{{sns_arn_id}}"
}'
scw tem webhook create \
--domain-id={{domain_id}} \
--project-id={{project_id}} \
--name="My webhook name" \
--event-types=email_delivered,email_dropped \
--sns-arn={{sns_arn_id}} \
--region=fr-par
```

<Message type="tip">
Expand All @@ -75,48 +69,40 @@ You will find examples of such calls below:
### List Webhooks

```bash
curl --request GET \
--url https://api.scaleway.com/transactional-email/v1alpha1/regions/fr-par/webhooks \
--header 'X-Auth-Token: {{token}}'
scw tem webhook list \
--region=fr-par
```
### Get a Webhook

```bash
curl --request GET \
--url https://api.scaleway.com/transactional-email/v1alpha1/regions/fr-par/webhooks/{{webhook_id}} \
--header 'X-Auth-Token: {{token}}'
scw tem webhook get \
--webhook-id={{webhook_id}} \
--region=fr-par
```
### Update a Webhook

```bash
curl --request PATCH \
--url https://api.scaleway.com/transactional-email/v1alpha1/regions/fr-par/webhooks/{{webhook_id}} \
--header 'X-Auth-Token: {{token}}'
--data '{
"name": "new name",
"event_types": [
"email_queued",
"email_mailbox_not_found",
"email_delivered",
"email_dropped"
],
"sns_arn": "{{sns_arn_id}}"
}'
scw tem webhook update \
--webhook-id={{webhook_id}} \
--name="new name" \
--event-types=email_queued,email_mailbox_not_found,email_delivered,email_dropped \
--sns-arn={{sns_arn_id}} \
--region=fr-par
```
### List Webhook events

```bash
curl --request GET \
--url https://api.scaleway.com/transactional-email/v1alpha1/regions/fr-par/webhooks/{{webhook_id}}/events \
--header 'X-Auth-Token: {{token}}'
scw tem webhook list-events \
--webhook-id={{webhook_id}} \
--region=fr-par
```

### Delete a Webhook

```bash
curl --request DELETE \
--url https://api.scaleway.com/transactional-email/v1alpha1/regions/fr-par/webhooks/{{webhook_id}} \
--header 'X-Auth-Token: {{token}}'
scw tem webhook delete \
--webhook-id={{webhook_id}} \
--region=fr-par
```

<Message type="tip">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,13 @@ cat > mail.json <<EOF
}
EOF

curl -X POST "https://api.scaleway.com/transactional-email/v1alpha1/regions/$REGION/emails" \
-H "X-Auth-Token: $TOKEN" \
-d @mail.json
scw tem email create \
[email protected] \
[email protected] \
--subject="This is a subject" \
--text="This is a short sentence." \
--project-id=<Scaleway Project ID> \
--region=$REGION
```
<Message type="important">
- If you have not configured your environment on your local machine, make sure you replace `\<project_id\>` with your [Project ID](/organizations-and-projects/concepts/#project), `$REGION` with `fr-par` and `$TOKEN` with your secret key. If you do not replace the Project ID, the API displays a "permission denied" error message.
Expand Down