Submit a quantum job (or a batch of circuits) to a device. data is the created job.

POST/jobs

Authorizations

X-API-KEYstringheaderrequired

Authenticate requests using an API key linked to your qBraid account. Obtain your key by registering or logging in at account.qbraid.com.

Body

application/jsonrequired
namestring

Job name

shotsintegerrequired

Number of shots to execute

deviceQrnstringrequired

qBraid device resource name

tagsobject

Job tags

runtimeOptionsobject

Runtime options

programobject | object[]required

A single program, or an array of programs for a batch submission (1-2000).

groupJobQrnstring

QRN of a job group to attach this job to.

Response

201Job created.
successbooleanrequired
dataobjectrequired

Schema for runtime job model

400Validation error.
403No execution access to the device.
Submit a job
curl --request POST \
  --url https://api-v2.qbraid.com/api/v1/jobs \
  --header 'X-API-KEY: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "<string>",
  "shots": 123,
  "deviceQrn": "<string>",
  "tags": {},
  "runtimeOptions": {},
  "program": {
    "format": "qasm2",
    "data": {}
  },
  "groupJobQrn": "<string>"
}'
import requests

url = "https://api-v2.qbraid.com/api/v1/jobs"
headers = {
    "X-API-KEY": "<api-key>",
    "Content-Type": "application/json"
}
payload = {
    "name": "<string>",
    "shots": 123,
    "deviceQrn": "<string>",
    "tags": {},
    "runtimeOptions": {},
    "program": {
        "format": "qasm2",
        "data": {}
    },
    "groupJobQrn": "<string>"
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())
const url = "https://api-v2.qbraid.com/api/v1/jobs";
const options = {
  method: "POST",
  headers: {"X-API-KEY":"<api-key>","Content-Type":"application/json"},
  body: JSON.stringify({
    "name": "<string>",
    "shots": 123,
    "deviceQrn": "<string>",
    "tags": {},
    "runtimeOptions": {},
    "program": {
      "format": "qasm2",
      "data": {}
    },
    "groupJobQrn": "<string>"
  }),
};

const response = await fetch(url, options);
console.log(await response.json());
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api-v2.qbraid.com/api/v1/jobs",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => '{
  "name": "<string>",
  "shots": 123,
  "deviceQrn": "<string>",
  "tags": {},
  "runtimeOptions": {},
  "program": {
    "format": "qasm2",
    "data": {}
  },
  "groupJobQrn": "<string>"
}',
  CURLOPT_HTTPHEADER => [
    "X-API-KEY: <api-key>",
    "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"
	"io"
	"net/http"
	"strings"
)

func main() {
	url := "https://api-v2.qbraid.com/api/v1/jobs"

	payload := strings.NewReader(`{
  "name": "<string>",
  "shots": 123,
  "deviceQrn": "<string>",
  "tags": {},
  "runtimeOptions": {},
  "program": {
    "format": "qasm2",
    "data": {}
  },
  "groupJobQrn": "<string>"
}`)

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-API-KEY", "<api-key>")
	req.Header.Add("Content-Type", "application/json")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))
}
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api-v2.qbraid.com/api/v1/jobs"))
    .header("X-API-KEY", "<api-key>")
    .header("Content-Type", "application/json")
    .method("POST", HttpRequest.BodyPublishers.ofString("{\n  \"name\": \"<string>\",\n  \"shots\": 123,\n  \"deviceQrn\": \"<string>\",\n  \"tags\": {},\n  \"runtimeOptions\": {},\n  \"program\": {\n    \"format\": \"qasm2\",\n    \"data\": {}\n  },\n  \"groupJobQrn\": \"<string>\"\n}"))
    .build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
require 'uri'
require 'net/http'

url = URI("https://api-v2.qbraid.com/api/v1/jobs")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = <<~JSON
  {
    "name": "<string>",
    "shots": 123,
    "deviceQrn": "<string>",
    "tags": {},
    "runtimeOptions": {},
    "program": {
      "format": "qasm2",
      "data": {}
    },
    "groupJobQrn": "<string>"
  }
JSON

response = http.request(request)
puts response.read_body
{
  "success": true,
  "data": {
    "name": "<string>",
    "shots": 123,
    "deviceQrn": "<string>",
    "tags": {},
    "runtimeOptions": {},
    "jobQrn": "<string>",
    "batchJobQrn": "<string>",
    "vendor": "aws",
    "provider": "aqt",
    "status": "<string>",
    "statusMsg": "<string>",
    "experimentType": "<string>",
    "queuePosition": 123,
    "timeStamps": {
      "createdAt": "2024-01-01T00:00:00Z",
      "endedAt": "2024-01-01T00:00:00Z",
      "executionDuration": 123
    },
    "cost": 123,
    "estimatedCost": 123,
    "metadata": {}
  }
}
{
  "success": false,
  "message": "<string>",
  "error": {
    "message": "<string>",
    "code": "<string>"
  }
}
{
  "success": false,
  "message": "<string>",
  "error": {
    "message": "<string>",
    "code": "<string>"
  }
}