Skip to main contentIBM Quantum Documentation

AI Routing methods


Get available backends

Gets the list of backends the user can work with

HTTP Response Status Codes

Status codeDescription
200Successful Response
422Validation Error

Code samples

GET
/routing/backends
curl -X GET \
  https://cloud-transpiler.quantum.ibm.com/routing/backends \
  -H 'Authorization: Bearer YOUR-TOKEN' \
  -H 'Accept: application/json'

Responses

[
  "example"
]

Route circuit to coupling map

Returns a task ID; use the '/routing/routing/{taskId}' endpoint to get the result.

Query Parameters

Name, TypeDescription
check_result
boolean

If true, the RL model will check the result before returning a response

Default value: false
optimization_level
integer

How much to optimize the circuit. Refer to https://docs.quantum.ibm.com/transpile/ai-transpiler-passes#ai-routing-pass

Default value: 2
layout_mode
string

Specifies how to handle the layout selection

Possible values: keepoptimizeimprove
Default value: keep

Body Parameters (application/json)

Name, TypeDescription
qasm
Required
string

The OpenQASM circuit to route. Both OpenQASM 2 and OpenQASM 3 are supported.

Example: "OPENQASM 3; include \"stdgates.inc\"; bit[2] meas; qubit[2] q; h q[0]; cx q[0], q[1]; barrier q[0], q[1]; meas[0] = measure q[0]; meas[1] = measure q[1];"
Example: "OPENQASM 2.0;\ninclude \"qelib1.inc\";\ngate dcx q0,q1 { cx q0,q1; cx q1,q0; }\nqreg q[3];\ncz q[0],q[2];\nsdg q[1];\ndcx q[2],q[1];\nu3(3.890139082217223,3.447697582994976,1.1583481971959322) q[0];\ncrx(2.3585459177723522) q[1],q[0];\ny q[2];"
coupling_map
Required
integer[][] | string

Example: [[0,1],[1,2],[2,3],[3,4],[4,5],[5,6],[6,7]]
Example: "ibm_sherbrooke"

HTTP Response Status Codes

Status codeDescription
200Successful Response
422Validation Error

Code samples

POST
/routing/routing
curl -X POST \
  https://cloud-transpiler.quantum.ibm.com/routing/routing \
  -H 'Authorization: Bearer YOUR-TOKEN' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{"qasm":"OPENQASM 3; include \"stdgates.inc\"; bit[2] meas; qubit[2] q; h q[0]; cx q[0], q[1]; barrier q[0], q[1]; meas[0] = measure q[0]; meas[1] = measure q[1];","coupling_map":[[0,1],[1,2],[2,3],[3,4],[4,5],[5,6],[6,7]]}'

Responses

{
  "task_id": "example"
}

Get routing result

Gets a task routing result. The Task ID needed for this endpoint is returned by /routing/routing

Path Parameters

Name, TypeDescription
task_id
Required
string

The ID of the routing task. This ID is returned by the '/routing/routing' POST endpoint.

HTTP Response Status Codes

Status codeDescription
200Successful Response
422Validation Error

Code samples

GET
/routing/routing/{task_id}
curl -X GET \
  https://cloud-transpiler.quantum.ibm.com/routing/routing/{task_id} \
  -H 'Authorization: Bearer YOUR-TOKEN' \
  -H 'Accept: application/json'

Responses

{
  "state": "example",
  "result": null
}
Was this page helpful?
Report a bug or request content on GitHub.