Quantum as a Service (QaaS) allows you access and program on diverse Quantum Processing Units (QPUs).
Configure your environment variables.
Note
This is an optional step that seeks to simplify your usage of the APIs
export ACCESS_KEY = "<access-key>"
export SECRET_KEY = "<secret-key>"
List the available Quantum as a service platforms. A platform is a formal definition of an allocable hardware, QPU or GPU with pre-installed emulator, you can select the one that better fits your use-case from our list.
curl -X GET \
-H "X-Auth-Token: $SCW_SECRET_KEY " \
-H "Content-Type: application/json" \
"https://api.scaleway.com/qaas/v1alpha1/platforms"
You should get a response like the following:
Important
Take note of the UUID of your platform of choice, as it will be used in the next step.
{
"total_count" : 17 ,
"platforms" : [
{
"id" : "282e9874-1761-499d-b0dc-004d0e334837" ,
"version" : "0.2" ,
"name" : "QPU-BELENOS-12PQ" ,
"provider_name" : "quandela" ,
"type" : "qpu" ,
"technology" : "photonic" ,
"max_qubit_count" : 12 ,
},
{
"id" : "5e52c364-03fd-4bf7-93e2-e1597e28fb83" ,
"version" : "0.1" ,
"name" : "QPU-EMERALD-54PQ" ,
"provider_name" : "iqm" ,
"type" : " qpu" ,
"technology" : "supraconductor" ,
"max_qubit_count" : 54 ,
},
{
"id" : "2pai198s-918b-6bf8-13en-y15wqe7epb88" ,
"version" : "0.17" ,
"name" : "EMU-AER-8L40S" ,
"provider_name" : "aer" ,
"type" : " simulator" ,
"technology" : "general-purpose" ,
"max_qubit_count" : 36 ,
}
[ ... ]
]
}
Run the following command to create a QPU session. A session is a time interval where a user can execute quantum jobs on a specific platform.
curl -X POST \
-H "X-Auth-Token: $SCW_SECRET_KEY " \
-H "Content-Type: application/json" \
-d '{
"project_id": "3j336ee9-dff0-4732-8c5a-bc4f2031ddd3",
"platform_id": "2pai198s-918b-6bf8-13en-y15wqe7epb88"
}' \
"https://api.scaleway.com/qaas/v1alpha1/sessions"
You can edit the request payload according to the information below:
If the operation was successful you will see a response like the following:
{
"id" : "6a134dca-5743-4ba6-9999-b84c295d591c" ,
"name" : "Justina" ,
"platform_id" : "5e52c364-03fd-4bf7-93e2-e1597e28fb83" ,
"started_at" : {
"seconds" : "-62135596800" ,
"nanos" : 0
},
"updated_at" : {
"seconds" : "1700063831" ,
"nanos" : 389384664
},
"terminated_at" : {
"seconds" : "-62135596800" ,
"nanos" : 0
},
"max_idle_duration" : {
"seconds" : "600" ,
"nanos" : 0
},
"max_duration" : {
"seconds" : "1800" ,
"nanos" : 0
},
"waiting_job_count" : "0" ,
"finished_job_count" : "0" ,
"status" : "starting" ,
"project_id" : "3j336ee9-dff0-4732-8c5a-bc4f2031ddd3" ,
"tags" : {
"value" : []
},
"deduplication_id" : "" ,
"created_at" : {
"seconds" : "1700063831" ,
"nanos" : 389384664
}
}
Important
Take note of the UUID of your session, as it will be used in the next step.
Create a job to execute your quantum cirtuit.
curl -X POST \
-H "X-Auth-Token: $SCW_SECRET_KEY " \
-H "Content-Type: application/json" \
-d '{
"circuit": {
"perceval_circuit": ":PCVL:zip:eJyzCnAO87FydM4sSi7NLLFydfTM9K9wdI7MSg52DsyO9AkNCtWu9DANqMj3cg50hAPP9GwvBM+xEKgWwXPxRFELAAdTHXM="
},
"name": "my_job",
"session_id": "3j336ee9-dff0-4732-8c5a-bc4f2031ddd3"
}' \
"https://api.scaleway.com/qaas/v1alpha1/jobs"
You can edit the request payload according to the information below:
If the operation was successful you will see a response like the following:
{
"id" : "f0febf59-14b8-4759-b342-09ab061691a3" ,
"name" : "Loremipsumconsequatdo" ,
"tags" : {
"value" : []
},
"session_id" : "f49a7157-93e9-4125-bd3c-b864bb93f6bc" ,
"created_at" : {
"seconds" : "1700064966" ,
"nanos" : 251006133
},
"updated_at" : {
"seconds" : "1700064966" ,
"nanos" : 251006133
},
"started_at" : {
"seconds" : "-62135596800" ,
"nanos" : 0
},
"status" : "waiting" ,
"progress_message" : {
"value" : ""
},
"job_duration" : {
"seconds" : "0" ,
"nanos" : 0
},
"result_distribution" : {
"value" : ""
}
}
Terminate your session once the job is complete. Make sure you specify the session_ID in the endpoint.
Note
This is an optional step, as all sessions have by default a set timeout of 30 minutes.
curl -X POST \
-H "X-Auth-Token: $SCW_SECRET_KEY " \
-H "Content-Type: application/json" \
"https://api.scaleway.com/qaas/v1alpha1/sessions/ $SESSION_ID /terminate"
If the operation was successful you will see a response like the following:
{
"id" : "6a134dca-5743-4ba6-9999-b84c295d591c" ,
"name" : "Justina" ,
"platform_id" : "5e52c364-03fd-4bf7-93e2-e1597e28fb83" ,
"started_at" : {
"seconds" : "1700064968" ,
"nanos" : 219871003
},
"updated_at" : {
"seconds" : "1700064975" ,
"nanos" : 489339876
},
"terminated_at" : {
"seconds" : "1700064975" ,
"nanos" : 489339876
},
"max_idle_duration" : {
"seconds" : "600" ,
"nanos" : 0
},
"max_duration" : {
"seconds" : "1800" ,
"nanos" : 0
},
"waiting_job_count" : "0" ,
"finished_job_count" : "0" ,
"status" : "stopping" ,
"project_id" : "3j336ee9-dff0-4732-8c5a-bc4f2031ddd3" ,
"tags" : {
"value" : []
},
"deduplication_id" : "" ,
"created_at" : {
"seconds" : "1700063831" ,
"nanos" : 389384664
}
}