Skip to main content
POST
/
scenarios
/
{scenario_id}
/
assignments
Assign scenario to user
curl --request POST \
  --url https://api.exec.com/rest/v1/scenarios/{scenario_id}/assignments \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "user_email": "[email protected]",
  "due_date": "2024-03-15T17:00:00Z",
  "assigner_email": "[email protected]",
  "attempt_min": 1,
  "attempt_max": 5,
  "rank_min": "silver",
  "custom_message": "Please complete this discovery call practice by Friday"
}
'
import requests

url = "https://api.exec.com/rest/v1/scenarios/{scenario_id}/assignments"

payload = {
"user_email": "[email protected]",
"due_date": "2024-03-15T17:00:00Z",
"assigner_email": "[email protected]",
"attempt_min": 1,
"attempt_max": 5,
"rank_min": "silver",
"custom_message": "Please complete this discovery call practice by Friday"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
user_email: '[email protected]',
due_date: '2024-03-15T17:00:00Z',
assigner_email: '[email protected]',
attempt_min: 1,
attempt_max: 5,
rank_min: 'silver',
custom_message: 'Please complete this discovery call practice by Friday'
})
};

fetch('https://api.exec.com/rest/v1/scenarios/{scenario_id}/assignments', 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.exec.com/rest/v1/scenarios/{scenario_id}/assignments",
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([
'user_email' => '[email protected]',
'due_date' => '2024-03-15T17:00:00Z',
'assigner_email' => '[email protected]',
'attempt_min' => 1,
'attempt_max' => 5,
'rank_min' => 'silver',
'custom_message' => 'Please complete this discovery call practice by Friday'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.exec.com/rest/v1/scenarios/{scenario_id}/assignments"

payload := strings.NewReader("{\n \"user_email\": \"[email protected]\",\n \"due_date\": \"2024-03-15T17:00:00Z\",\n \"assigner_email\": \"[email protected]\",\n \"attempt_min\": 1,\n \"attempt_max\": 5,\n \"rank_min\": \"silver\",\n \"custom_message\": \"Please complete this discovery call practice by Friday\"\n}")

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

req.Header.Add("Authorization", "Bearer <token>")
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.exec.com/rest/v1/scenarios/{scenario_id}/assignments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"user_email\": \"[email protected]\",\n \"due_date\": \"2024-03-15T17:00:00Z\",\n \"assigner_email\": \"[email protected]\",\n \"attempt_min\": 1,\n \"attempt_max\": 5,\n \"rank_min\": \"silver\",\n \"custom_message\": \"Please complete this discovery call practice by Friday\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.exec.com/rest/v1/scenarios/{scenario_id}/assignments")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"user_email\": \"[email protected]\",\n \"due_date\": \"2024-03-15T17:00:00Z\",\n \"assigner_email\": \"[email protected]\",\n \"attempt_min\": 1,\n \"attempt_max\": 5,\n \"rank_min\": \"silver\",\n \"custom_message\": \"Please complete this discovery call practice by Friday\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "a1s2s3i4g5n6",
  "user": {
    "id": "u1a2b3c4d5e6",
    "email": "[email protected]",
    "first_name": "Jane",
    "last_name": "Smith"
  },
  "scenario": {
    "id": "s1c2e3n4a5r6",
    "name": "Discovery Call",
    "slug": "discovery-call"
  },
  "status": "not_started",
  "due_date": "2024-03-15T17:00:00Z",
  "best_score": null,
  "best_rank": null,
  "attempt_count": 0,
  "attempt_min": 1,
  "attempt_max": 5,
  "rank_min": "silver",
  "program": null,
  "created_at": "2024-03-01T10:00:00Z"
}
{
"error": {
"type": "invalid_request",
"code": "invalid_pagination",
"message": "Invalid pagination parameters"
}
}
{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "Invalid or inactive API key"
}
}
{
"error": {
"type": "not_found",
"message": "Scenario not found: abc123"
}
}

Authorizations

Authorization
string
header
required

API key created in Settings > API.

Format: exec_live_ followed by 40 alphanumeric characters.

Path Parameters

scenario_id
string
required

Scenario identifier

Body

application/json
user_email
string<email>
required

Email of the user to assign the scenario to

due_date
string<date-time>
required

When the assignment is due (ISO 8601 format)

assigner_email
string<email>

Email of the user creating the assignment (optional, used in notification emails)

attempt_min
integer

Minimum number of attempts required

Required range: x >= 1
attempt_max
integer

Maximum number of attempts allowed

Required range: x >= 1
rank_min
enum<string>

Minimum rank required to complete

Available options:
gold,
silver,
bronze
custom_message
string

Custom message to include with the assignment

Response

Assignment created successfully

A scenario assignment given to a user as a practice task.

id
string

Unique assignment identifier

user
object
scenario
object

A compact scenario reference for embedding in other responses.

status
enum<string>

Current assignment status

Available options:
not_started,
in_progress,
completed,
past_due,
did_not_pass
due_date
string<date-time> | null

When the assignment is due

best_score
number | null

Highest score achieved on this assignment

best_rank
enum<string> | null

Rank from the best scoring attempt

Available options:
gold,
silver,
bronze,
unranked
attempt_count
integer

Number of completed attempts

attempt_min
integer | null

Minimum attempts required

attempt_max
integer | null

Maximum attempts allowed

rank_min
enum<string> | null

Minimum rank required to pass

Available options:
gold,
silver,
bronze,
unranked
program
object | null

Program this assignment belongs to (null if standalone)

created_at
string<date-time>