Skip to main content
IBM Quantum Platform
This is the API reference for the Qiskit Runtime REST API on the new IBM Quantum Platform, which replaces the REST APIs for IBM Quantum Platform (Classic) Qiskit Runtime and IBM Cloud Qiskit Runtime. For more details, including how to migrate, visit the guide Migrate to the new Qiskit Runtime REST API.

Sessions


Create a session

Create a session

Body Parameters (application/json)

Name, TypeDescription

HTTP Response Status Codes

Status codeDescription
200Ok
400Bad Request
401Unauthorized
500Internal error

Code samples

POST
/v1/sessions
curl -X POST \
  /api/v1/sessions \
  -H 'Authorization: Bearer YOUR-TOKEN' \
  -H 'Accept: application/json'

Responses

{
  "id": "example",
  "backend_name": "example",
  "started_at": "example",
  "activated_at": "example",
  "closed_at": "example",
  "last_job_started": "example",
  "last_job_completed": "example",
  "interactive_ttl": 1,
  "max_ttl": 1,
  "active_ttl": 1,
  "state": "open",
  "state_reason": "example",
  "accepting_jobs": true,
  "mode": "batch",
  "timestamps": [
    {
      "status": "open",
      "timestamp": "example"
    }
  ],
  "user_id": "example",
  "elapsed_time": 1.432
}

Get a session

Get a session

Path Parameters

Name, TypeDescription
id
Required
string

Job Session ID

HTTP Response Status Codes

Status codeDescription
200OK
401Unauthorized
404Not Found
500Internal error

Code samples

GET
/v1/sessions/{id}
curl -X GET \
  /api/v1/sessions/{id} \
  -H 'Authorization: Bearer YOUR-TOKEN' \
  -H 'Accept: application/json'

Responses

{
  "id": "example",
  "backend_name": "example",
  "started_at": "example",
  "activated_at": "example",
  "closed_at": "example",
  "last_job_started": "example",
  "last_job_completed": "example",
  "interactive_ttl": 1,
  "max_ttl": 1,
  "active_ttl": 1,
  "state": "open",
  "state_reason": "example",
  "accepting_jobs": true,
  "mode": "batch",
  "timestamps": [
    {
      "status": "open",
      "timestamp": "example"
    }
  ],
  "user_id": "example",
  "elapsed_time": 1.432
}

Update a session

Update a session

Path Parameters

Name, TypeDescription
id
Required
string

Job Session ID

Body Parameters (application/json)

Name, TypeDescription
accepting_jobs
Required
boolean

If true, the session is actively accepting new jobs to be queued. If false, jobs will be rejected on create and the session will be immediately closed when there are no more jobs to run in the session.

HTTP Response Status Codes

Status codeDescription
204Successfully updated session
401Unauthorized
404Not Found
500Internal error

Code samples

PATCH
/v1/sessions/{id}
curl -X PATCH \
  /api/v1/sessions/{id} \
  -H 'Authorization: Bearer YOUR-TOKEN' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{"accepting_jobs":true}'

Responses

Successfully updated session

Close job session

Closes the runtime session

Path Parameters

Name, TypeDescription
id
Required
string

Session Id

HTTP Response Status Codes

Status codeDescription
204Successfully closed runtime session

Code samples

DELETE
/v1/sessions/{id}/close
curl -X DELETE \
  /api/v1/sessions/{id}/close \
  -H 'Authorization: Bearer YOUR-TOKEN' \
  -H 'Accept: application/json'

Responses

Successfully closed runtime session
Was this page helpful?
Report a bug or request content on GitHub.