Skip to main contentIBM Quantum Documentation
Qiskit Transpiler Service is only available for IBM Quantum Premium Plan members.

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 reinforcement learning (RL) model checks 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
string | null

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];"
qpy
string | null

The QPY circuit to route. QPY circuits must be encoded in Base64.

Example: "UUlTS0lUDAECBAAAAAAAAAABZXEAEWYACAAAAAIAAAACAAAAAAAAAAIAAAACAAAAAAAAAAUAAAAAY2lyY3VpdC0xNzgtNTAxNTcAAAAAAAAAAHt9cQEAAAACAAEBcQAAAAAAAAAAAAAAAAAAAAFjAQAAAAIABAFtZWFzAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASEdhdGVxAAAAAAAGAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAABAAAAAUNYR2F0ZXEAAAAAcQAAAAEABwAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABCYXJyaWVycQAAAABxAAAAAQAHAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAE1lYXN1cmVxAAAAAGMAAAAAAAcAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAATWVhc3VyZXEAAAABYwAAAAEAAAD///////////////8AAAAAAAAAAA=="
coupling_map
Required
integer[][] | string

Example: [[0,1],[1,2],[2,3],[3,4],[4,5],[5,6],[6,7]]
Example: "ibm_sherbrooke"
optimization_preferences
string | string[] | null

Describe your preferences with a value or a list of values when prioritizing optimization. Allowed options: noise, n_cnots, n_gates, cnot_layers, layers.

Example: ["noise","n_gates"]
Example: "n_cnots"

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 '{"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.