curl --request POST \
--url 'https://api.example.com/ai/transpile_circuits?HAIQU_API_KEY=' \
--header 'Content-Type: application/json' \
--data '
{
"experiment_id": "<string>",
"device_id": "<string>",
"circuit_ids": [],
"transpilation_options": {},
"use_fractional_gates": false,
"name": "",
"description": "",
"circuits_qasm": [
"<string>"
]
}
'import requests
url = "https://api.example.com/ai/transpile_circuits?HAIQU_API_KEY="
payload = {
"experiment_id": "<string>",
"device_id": "<string>",
"circuit_ids": [],
"transpilation_options": {},
"use_fractional_gates": False,
"name": "",
"description": "",
"circuits_qasm": ["<string>"]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
experiment_id: '<string>',
device_id: '<string>',
circuit_ids: [],
transpilation_options: {},
use_fractional_gates: false,
name: '',
description: '',
circuits_qasm: ['<string>']
})
};
fetch('https://api.example.com/ai/transpile_circuits?HAIQU_API_KEY=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/ai/transpile_circuits?HAIQU_API_KEY=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'experiment_id' => '<string>',
'device_id' => '<string>',
'circuit_ids' => [
],
'transpilation_options' => [
],
'use_fractional_gates' => false,
'name' => '',
'description' => '',
'circuits_qasm' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/ai/transpile_circuits?HAIQU_API_KEY="
payload := strings.NewReader("{\n \"experiment_id\": \"<string>\",\n \"device_id\": \"<string>\",\n \"circuit_ids\": [],\n \"transpilation_options\": {},\n \"use_fractional_gates\": false,\n \"name\": \"\",\n \"description\": \"\",\n \"circuits_qasm\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/ai/transpile_circuits?HAIQU_API_KEY=")
.header("Content-Type", "application/json")
.body("{\n \"experiment_id\": \"<string>\",\n \"device_id\": \"<string>\",\n \"circuit_ids\": [],\n \"transpilation_options\": {},\n \"use_fractional_gates\": false,\n \"name\": \"\",\n \"description\": \"\",\n \"circuits_qasm\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/ai/transpile_circuits?HAIQU_API_KEY=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"experiment_id\": \"<string>\",\n \"device_id\": \"<string>\",\n \"circuit_ids\": [],\n \"transpilation_options\": {},\n \"use_fractional_gates\": false,\n \"name\": \"\",\n \"description\": \"\",\n \"circuits_qasm\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"context": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Transpile Circuits
Submit one or more circuits for transpilation on a target backend.
Use this tool when the caller needs backend-aware transpilation before
execution, comparison, or further circuit analysis. The request accepts
existing circuit_ids or inline circuits_qasm. When QASM is
supplied, the endpoint creates persistent circuit records associated with
the experiment before submitting the transpilation job.
When to Use:
- Call this after
list_qpus_and_simulatorsreturns a validdevice_idfor the target backend. - Call this when the user wants transpiled circuit IDs, not immediate final circuits inline.
Constraints:
- Provide at least one of
circuit_idsorcircuits_qasm. device_idshould be passed exactly as returned bylist_qpus_and_simulators.- The response is a lightweight context wrapper; use
get_job_results_and_statusto retrieve terminal outputs such astranspiled_circuit_ids.
Notes:
transpilation_optionsis forwarded to the backend-facing transpilation path and may contain device-specific settings.- Circuits created from inline QASM are stored under the experiment so they remain visible in Haiqu UI flows and later MCP calls.
- There is no practical size limit on
circuits_qasm. For circuits already stored, prefercircuit_idsso large QASM payloads are sent at most once; never downscale an instance because its QASM looks large.
Args: user: Authenticated user resolved from the API key. data: Transpilation payload containing the experiment scope, target backend, existing circuit IDs and/or inline QASM circuits, and optional transpilation settings. db: Active database session.
Returns: A lightweight context wrapper summarizing the created transpilation job and the next polling step.
Raises:
HTTPException: Raised with 400 when neither circuit_ids nor
circuits_qasm is provided, 402 when the caller cannot
submit billable jobs, or 404 when the experiment is not
available to the caller.
curl --request POST \
--url 'https://api.example.com/ai/transpile_circuits?HAIQU_API_KEY=' \
--header 'Content-Type: application/json' \
--data '
{
"experiment_id": "<string>",
"device_id": "<string>",
"circuit_ids": [],
"transpilation_options": {},
"use_fractional_gates": false,
"name": "",
"description": "",
"circuits_qasm": [
"<string>"
]
}
'import requests
url = "https://api.example.com/ai/transpile_circuits?HAIQU_API_KEY="
payload = {
"experiment_id": "<string>",
"device_id": "<string>",
"circuit_ids": [],
"transpilation_options": {},
"use_fractional_gates": False,
"name": "",
"description": "",
"circuits_qasm": ["<string>"]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
experiment_id: '<string>',
device_id: '<string>',
circuit_ids: [],
transpilation_options: {},
use_fractional_gates: false,
name: '',
description: '',
circuits_qasm: ['<string>']
})
};
fetch('https://api.example.com/ai/transpile_circuits?HAIQU_API_KEY=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/ai/transpile_circuits?HAIQU_API_KEY=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'experiment_id' => '<string>',
'device_id' => '<string>',
'circuit_ids' => [
],
'transpilation_options' => [
],
'use_fractional_gates' => false,
'name' => '',
'description' => '',
'circuits_qasm' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/ai/transpile_circuits?HAIQU_API_KEY="
payload := strings.NewReader("{\n \"experiment_id\": \"<string>\",\n \"device_id\": \"<string>\",\n \"circuit_ids\": [],\n \"transpilation_options\": {},\n \"use_fractional_gates\": false,\n \"name\": \"\",\n \"description\": \"\",\n \"circuits_qasm\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/ai/transpile_circuits?HAIQU_API_KEY=")
.header("Content-Type", "application/json")
.body("{\n \"experiment_id\": \"<string>\",\n \"device_id\": \"<string>\",\n \"circuit_ids\": [],\n \"transpilation_options\": {},\n \"use_fractional_gates\": false,\n \"name\": \"\",\n \"description\": \"\",\n \"circuits_qasm\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/ai/transpile_circuits?HAIQU_API_KEY=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"experiment_id\": \"<string>\",\n \"device_id\": \"<string>\",\n \"circuit_ids\": [],\n \"transpilation_options\": {},\n \"use_fractional_gates\": false,\n \"name\": \"\",\n \"description\": \"\",\n \"circuits_qasm\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"context": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Body
Define payload for MCP transpilation submissions.
This model extends :class:haiqu.sdk.schemas.SubmitTranspilationModel with
optional inline QASM input so agents can submit and transpile circuits in
one operation.
Attributes:
experiment_id: Parent experiment identifier for the transpilation job.
circuit_ids: Existing stored circuit IDs to transpile. Use either this
field or circuits_qasm.
circuits_qasm: Inline QASM circuits to persist and transpile in one
step.
device_id: Backend identifier returned by
list_qpus_and_simulators.
transpilation_options: Optional backend-specific Qiskit transpilation options
forwarded to the underlying transpilation path (not including
use_fractional_gates, which is a separate top-level field).
use_fractional_gates: When True, transpile against an IBM Target with
fractional gates enabled (real IBM QPUs only).
name: Optional job name inherited from the SDK model.
description: Optional plain-text job description inherited from the SDK
model.
Backend-specific transpilation options. For example: {'optimization_level': 2}.
List of quantum circuits in QASM 2.0 or 3.0 format. Use either this field or circuit_ids field to specify the existing circuits IDs to transpile.
Response
Successful Response
Represent context payload returned after transpilation job creation.
Attributes:
context: Submission summary text including the created job ID, the
input circuit references, and the next polling step. This response
model does not expose structured job_id or
transpiled_circuit_ids fields outside the text payload.