CreateQuantumTask
Creates a quantum task.
Request Syntax
POST /quantum-task HTTP/1.1
Content-type: application/json
{
   "action": "string",
   "associations": [ 
      { 
         "arn": "string",
         "type": "string"
      }
   ],
   "clientToken": "string",
   "deviceArn": "string",
   "deviceParameters": "string",
   "jobToken": "string",
   "outputS3Bucket": "string",
   "outputS3KeyPrefix": "string",
   "shots": number,
   "tags": { 
      "string" : "string" 
   }
}URI Request Parameters
The request does not use any URI parameters.
Request Body
The request accepts the following data in JSON format.
- action
- 
               The action associated with the quantum task. Type: String Required: Yes 
- associations
- 
               The list of Amazon Braket resources associated with the quantum task. Type: Array of Association objects Array Members: Minimum number of 0 items. Maximum number of 1 item. Required: No 
- clientToken
- 
               The client token associated with the request. Type: String Length Constraints: Minimum length of 1. Maximum length of 64. Required: Yes 
- deviceArn
- 
               The ARN of the device to run the quantum task on. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Required: Yes 
- deviceParameters
- 
               The parameters for the device to run the quantum task on. Type: String Length Constraints: Minimum length of 1. Maximum length of 48000. Required: No 
- jobToken
- 
               The token for an Amazon Braket hybrid job that associates it with the quantum task. Type: String Length Constraints: Minimum length of 1. Maximum length of 128. Required: No 
- outputS3Bucket
- 
               The S3 bucket to store quantum task result files in. Type: String Length Constraints: Minimum length of 3. Maximum length of 63. Required: Yes 
- outputS3KeyPrefix
- 
               The key prefix for the location in the S3 bucket to store quantum task results in. Type: String Length Constraints: Minimum length of 1. Maximum length of 1024. Required: Yes 
- shots
- 
               The number of shots to use for the quantum task. Type: Long Valid Range: Minimum value of 0. Required: Yes 
- 
               Tags to be added to the quantum task you're creating. Type: String to string map Required: No 
Response Syntax
HTTP/1.1 201
Content-type: application/json
{
   "quantumTaskArn": "string"
}Response Elements
If the action is successful, the service sends back an HTTP 201 response.
The following data is returned in JSON format by the service.
- quantumTaskArn
- 
               The ARN of the quantum task created by the request. Type: String Length Constraints: Minimum length of 0. Maximum length of 256. 
Errors
For information about the errors that are common to all actions, see Common Errors.
- AccessDeniedException
- 
               You do not have sufficient permissions to perform this action. HTTP Status Code: 403 
- DeviceOfflineException
- 
               The specified device is currently offline. HTTP Status Code: 424 
- DeviceRetiredException
- 
               The specified device has been retired. HTTP Status Code: 410 
- InternalServiceException
- 
               The request failed because of an unknown error. HTTP Status Code: 500 
- ServiceQuotaExceededException
- 
               The request failed because a service quota is exceeded. HTTP Status Code: 402 
- ThrottlingException
- 
               The API throttling rate limit is exceeded. HTTP Status Code: 429 
- ValidationException
- 
               The input request failed to satisfy constraints expected by Amazon Braket. - programSetValidationFailures
- 
                        The validation failures in the program set submitted in the request. 
- reason
- 
                        The reason for validation failure. 
 HTTP Status Code: 400 
Examples
OpenQASM 3.0 action example
The following code is an example of the action parameter for creating an OpenQASM 3.0 quantum task.
{ "braketSchemaHeader": { "name": "braket.ir.openqasm.program", "version": "1" }, "source": "OPENQASM 3; qubit[2] q; bit[2] c; h q[0]; cnot q[0], q[1]; c = measure q;" }
ProgramSet action example
The following code shows the action parameter for creating a 
               ProgramSet quantum task with two programs: one with 
               three sets of input parameters (theta and phi), and one with no input parameters.
{ "braketSchemaHeader": { "name": "braket.ir.openqasm.program_set", "version": "1" }, "programs": [ { "braketSchemaHeader": { "name": "braket.ir.openqasm.program", "version": "1" }, "source": "OPENQASM 3.0;\\ninput float phi;\\ninput float theta;\\nbit[2] b;\\nqubit[2] q;\\nrx(theta) q[0];\\ncnot q[0], q[1];\\nrz(phi) q[1];\\nb[0] = measure q[0];\\nb[1] = measure q[1];", "inputs": { "theta": [ 1.23, 1.73, 0.73 ], "phi": [ 0.12, -0.38, 0.62 ] } }, { "braketSchemaHeader": { "name": "braket.ir.openqasm.program", "version": "1" }, "source": "OPENQASM 3.0;\\nbit[2] b;\\nqubit[2] q;\\nh q[0];\\ncnot q[0], q[1];\\nb[0] = measure q[0];\\nb[1] = measure q[1];", "inputs": {} } ] }
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: