NavigationContentFooter
Jump toSuggest an edit

Managing projects using Scaleway APIs

Reviewed on 06 December 2023Published on 25 July 2022

This page explains how to manage Projects using Scaleway APIs.

Before you start

To complete the actions presented below, you must have:

  • A Scaleway account logged into the console
  • Configured your API keys
  • An API key with the IAMManager or ProjectManager permission sets

Creating a Project

You need your secret key and your Organization ID for the step below.

Open a terminal and type the following command to create a Project. If you have not configured your environment in your local machine, make sure you replace $SCW_SECRET_KEY with your secret key and $SCW_DEFAULT_ORGANIZATION_ID with the ID of your Organization.

curl -XPOST https://api.scaleway.com/account/v2/projects -H 'X-Auth-Token: $SCW_SECRET_KEY' -d '{"organization_id":"$SCW_DEFAULT_ORGANIZATION_ID","name":"name-of-project"}'

An output similar to the following displays:

{
"id":"6170692e-7363-616c-6577-61792e636f6d",
"name":"test-project",
"organization_id":"3e44a89e-1f75-45f5-9b93-422db94165eb",
"created_at":"2022-07-19T15:02:43.455727Z",
"updated_at":"2022-07-19T15:02:43.455727Z",
"description":""
}

Updating Projects

You need your secret key and the ID of the Project you want to update for the step below. For this use case, we are updating the Project created in the step above.

Note

You can only update the name and description of your Project.

Type the following command into your terminal to update your Project:

curl -XPATCH https://api.scaleway.com/account/v2/projects/<SCW_PROJECT_ID> -H 'X-Auth-Token: $SCW_SECRET_KEY' -d '{"name":"new-project", "description": "This is my updated project" }'

An output similar to the following displays:

{
"id":"6170692e-7363-616c-6577-61792e636f6d",
"name":"new-project",
"organization_id":"3e44a89e-1f75-45f5-9b93-422db94165eb",
"created_at":"2022-07-19T15:02:43.455727Z",
"updated_at":"2022-07-19T15:29:27.762100Z",
"description":"This is my updated project"
}

Listing all your Projects

Note
  • There is a default Project in all Organizations.
  • The default Project’s Project ID is the same as the Organization ID.
  • The default Project cannot be deleted.

You need your secret key and your Organization ID for the step below.

Type the following command into your terminal to list your Projects:

curl -XGET https://api.scaleway.com/account/v2/projects\?organization_id\=<SCW_DEFAULT_ORGANIZATION_ID>&page=1&page_size=10&order_by=created_at_asc -H 'X-Auth-Token: $SCW_SECRET_KEY'

An output similar to the following displays:

{
"total_count":2,
"projects":[
{
"id":"3e44a89e-1f75-45f5-9b93-422db94165eb",
"name":"default",
"organization_id":"3e44a89e-1f75-45f5-9b93-422db94165eb",
"created_at":"2021-07-06T15:15:48.375181Z",
"updated_at":"2021-07-06T15:15:48.375181Z",
"description":""
},
{
"id":"6170692e-7363-616c-6577-61792e636f6d",
"name":"new-project",
"organization_id":"3e44a89e-1f75-45f5-9b93-422db94165eb",
"created_at":"2022-07-19T15:02:43.455727Z",
"updated_at":"2022-07-19T15:29:27.762100Z",
"description":"This is my updated project"
}
]
}

Retrieving a specific Project

You need your secret key and the ID of the Project you want to get for the step below. For this use case, we are getting the Project we have updated in the updating Projects step.

Type the following command to list a specific Project.

curl -XGET https://api.scaleway.com/account/v2/projects/<SCW_PROJECT_ID> -H 'X-Auth-Token: $SCW_SECRET_KEY'

An output similar to the following displays:

{
"id":"6170692e-7363-616c-6577-61792e636f6d",
"name":"new-project",
"organization_id":"3e44a89e-1f75-45f5-9b93-422db94165eb",
"created_at":"2022-07-19T15:02:43.455727Z",
"updated_at":"2022-07-19T15:29:27.762100Z",
"description":"This is my updated project"
}

Deleting a Project

You need your secret key and the ID of the Project you want to delete for the step below. For this use case, we are deleting the Project we have created in the creating a Project step.

  1. Type the following command to delete a Project.
    curl -XDELETE https://api.scaleway.com/account/v2/projects/<YOUR_PROJECT_ID> -H 'X-Auth-Token: $SCW_SECRET_KEY'
  2. Run the following command to list your Projects and make sure you have deleted your Project.
    curl -XGET https://api.scaleway.com/account/v2/projects\?organization_id\=<SCW_DEFAULT_ORGANIZATION_ID> -H "X-Auth-Token: $SCW_SECRET_KEY"

An output similar to the following displays, confirming that you have one Project left:

{
"total_count": 1,
"projects": [
{
"id":"3e44a89e-1f75-45f5-9b93-422db94165eb",
"name":"default",
"organization_id":"3e44a89e-1f75-45f5-9b93-422db94165eb",
"created_at":"2021-07-06T15:15:48.375181Z",
"updated_at":"2021-07-06T15:15:48.375181Z",
"description":""
}
]
}
Docs APIScaleway consoleDedibox consoleScaleway LearningScaleway.comPricingBlogCarreer
© 2023-2024 – Scaleway