Authentication
All calls to the FlexiQuiz API require your account API key to be passed within the request header X-API-KEY.
An API key for the account can be generated within the Settings screen by the user who originally created your FlexiQuiz account.
For more details please review our API overview
Example Request
$ curl https://www.flexiquiz.com/api/v1/quizzes -H "X-API-KEY: fcb7f59c-2a4f-44a9-8281-34cbfd97be99"
Error codes
FlexiQuiz returns standard HTTP error codes.
Code | Description |
200 | OK |
400 | Bad Request |
403 | Forbidden |
403.4 | SSL required |
404 | Not Found |
422 | Unprocessable Entity |
429 | Exceeded request rate limit |
500 | Internal Server Error |
Rate limits
FlexiQuiz limits the number of API requests that you can make for an API Key per minute and hour.
If the rate limit is exceeded then a code of 429: Exceeded request rate limit will be returned
Period | Limit |
Minute | 60 |
Hour | 2000 |
Dates
All dates are returned using the UTC timezone and in the format yyyy-MM-dd hh:mm:ss
Example Date
2018-10-21 08:06:59
Request content type
For POST requests the content type should be set to application/x-www-form-urlencoded
In curl the default content type is application/x-www-form-urlencoded, so is not included in the example requests.
Example Request
$ curl https://www.flexiquiz.com/api/v1/quizzes -H "X-API-KEY: fcb7f59c-2a4f-44a9-8281-34cbfd97be99"
Get all quizzes
Returns a list of all quizzes in the account
The status element will be: in_design, open, closed
GET /v1/quizzes
Example Request
$ curl https://www.flexiquiz.com/api/v1/quizzes -H "X-API-KEY: fcb7f59c-2a4f-44a9-8281-34cbfd97be99"
Example Response
[
{
"quiz_id": "b96ad67c-34c9-4bce-bb2c-076f2619dacd",
"name": "Aptitude",
"status": "open",
"date_created": "2018-05-10 21:06:12"
},
{
"quiz_id": "ef403ba9-e6ee-4cc6-a921-12ef135a7b3b",
"name": "Numerical reasoning",
"status": "in_design",
"date_created": "2018-01-15 04:25:50"
}
]
Get a quiz
Returns a single quiz
The status element will be: in_design, open, closed
GET /v1/quizzes/{quiz_id}
Example Request
$ curl https://www.flexiquiz.com/api/v1/quizzes/b96ad67c-34c9-4bce-bb2c-076f2619dacd -H "X-API-KEY: fcb7f59c-2a4f-44a9-8281-34cbfd97be99"
Example Response
{
"quiz_id": "b96ad67c-34c9-4bce-bb2c-076f2619dacd",
"name": "Aptitude",
"status": "open",
"date_created": "2018-05-10 21:06:12"
}
Create a quiz
Creates a new quiz.
POST /v1/quizzes
Example Request
$ curl https://www.flexiquiz.com/api/v1/quizzes -H "X-API-KEY: fcb5f59c-2a2f-44a9-8261-33cbfa97be99" -d name="new quiz"
Example Response
{
"quiz_id": "348c6608-a834-4096-ba20-01f67290a146"
}
Update a quiz
Updates the name and status of the specified quiz. When calling you can just include any fields you would like updated.
The example will change the status of the quiz to closed and leave the name unchanged.
Parameters
name (optional)
status (optional): the quiz status can be changed to open or closed
POST /v1/quizzes/{quiz_id}
Example Request
$ curl https://www.flexiquiz.com/api/v1/quizzes/b96ad67c-34c9-4bce-bb2c-076f2619dacd -H "X-API-KEY: fcb7f59c-2a4f-44a9-8281-34cbfd97be99" -d status="closed"
Example Response
{
"message": "200: OK"
}
Delete a quiz
Deletes the specified quiz.
DELETE /v1/quizzes/{quiz_id}
Example Request
$ curl https://www.flexiquiz.com/api/v1/quizzes/b96ad67c-34c9-4bce-bb2c-076f2619dacd -H "X-API-KEY: fcb7f59c-2a4f-44a9-8281-34cbfd97be99" -X DELETE
Example Response
{
"message": "200: OK"
}
Copy a quiz
Copies a quiz.
Parameters
name (optional): the name of the new quiz
POST /v1/quizzes/{quiz_id}/copy
Example Request
$ curl https://www.flexiquiz.com/api/v1/quizzes/b96ad67c-34c9-4bce-bb2c-076f2619dacd/copy -H "X-API-KEY: fcb5f59c-2a2f-44a9-8261-33cbfa97be99" -d name="new quiz"
Example Response
{
"quiz_id": "e9470b84-9172-4321-8e1c-100ae313168d"
}
Get all responses
Returns a list of all responses to a quiz.
status can be not_started not_submitted or submitted, percentage score 0-100, publish type, certificate_url and response_report_url, duration is in seconds
GET /v1/quizzes/{quiz_id}/responses
Example Request
$ curl https://www.flexiquiz.com/api/v1/quizzes/b96ad67c-34c9-4bce-bb2c-076f2619dacd/responses -H "X-API-KEY: fcb7f59c-2a4f-44a9-8281-34cbfd97be99"
Example Response
[
{
"response_id": "bf1dd7b8-a908-45bf-bd98-e62831de921a",
"quiz_id": "b96ad67c-34c9-4bce-bb2c-076f2619dacd",
"quiz_name": "Aptitude",
"first_name": "Jane",
"last_name": "Jones",
"email_address": "jane@flexiquiz.com",
"user_id": null,
"user_name": null,
"date_submitted": "2018-10-18 08:36:45",
"points": 84,
"available_points": 84.00,
"percentage_score": 100,
"grade": "A",
"pass": true,
"duration": 625,
"attempt": 1,
"ip_address": "::1",
"status": "submitted",
"publish_type": "quiz_link",
"certificate_url": "",
"response_report_url": "not_in_use",
"registration_fields": [
{
"name": "First name",
"value": "Jane"
},
{
"name": "Last name",
"value": "Jones"
},
{
"name": "Email address",
"value": "jane@flexiquiz.com"
},
{
"name": "Office",
"value": "New York"
}
},
{
"response_id": "3f8acd60-cbef-4e98-a0cd-0a10302dcd40",
"quiz_id": "b96ad67c-34c9-4bce-bb2c-076f2619dacd",
"quiz_name": "Aptitude",
"first_name": "Henry",
"last_name": "Patterson",
"email_address": "henry@flexiquiz.com",
"user_id": "cee9808d-b234-4a8d-8526-8fea6c335056",
"user_name": "henry@flexiquiz.com",
"date_submitted": "2018-10-21 08:06:59",
"points": 70,
"available_points": 84.00,
"percentage_score": 83,
"grade": "B",
"pass": true,
"duration": 547,
"attempt": 2,
"ip_address": "::1",
"status": "submitted",
"publish_type": "assigned_user",
"certificate_url": "",
"response_report_url": "not_in_use",
"registration_fields": [ ]
}
]
Get a response
Returns a single response.
status, percentage score 0-100, publish type, certificate_url and response_report_url, duration is in seconds
GET /v1/quizzes/{quiz_id}/responses/{response_id}
Example Request
$ curl https://www.flexiquiz.com/api/v1/quizzes/b96ad67c-34c9-4bce-bb2c-076f2619dacd/responses/bf1dd7b8-a908-45bf-bd98-e62831de921a -H "X-API-KEY: fcb7f59c-2a4f-44a9-8281-34cbfd97be99"
Example Response
{
"response_id": "bf1dd7b8-a908-45bf-bd98-e62831de921a",
"quiz_id": "b96ad67c-34c9-4bce-bb2c-076f2619dacd",
"quiz_name": "Aptitude",
"first_name": "Jane",
"last_name": "Jones",
"email_address": "jane@flexiquiz.com",
"user_id": null,
"user_name": null,
"date_submitted": "2018-10-18 08:36:45",
"points": 84,
"available_points": 84.00,
"percentage_score": 100,
"grade": "A",
"pass": true,
"duration": 625,
"attempt": 1,
"ip_address": "::1",
"status": "submitted",
"publish_type": "quiz_link",
"certificate_url": "",
"response_report_url": "not_in_use",
"registration_fields": [
{
"name": "First name",
"value": "Jane"
},
{
"name": "Last name",
"value": "Jones"
},
{
"name": "Email address",
"value": "jane@flexiquiz.com"
},
{
"name": "Office",
"value": "New York"
}
]
}
Delete a response
Deletes the specified response.
DELETE /v1/quizzes/{quiz_id}/responses/{response_id}
Example Request
$ curl https://www.flexiquiz.com/api/v1/quizzes/b96ad67c-34c9-4bce-bb2c-076f2619dacd/responses/bf1dd7b8-a908-45bf-bd98-e62831de921a -H "X-API-KEY: fcb7f59c-2a4f-44a9-8281-34cbfd97be99" -X DELETE
Example Response
{
"message": "200: OK"
}
Get a responses questions
Returns a list of all questions and answers to a response.
GET /v1/quizzes/{quiz_id}/responses/{response_id}/questions
Example Request
$ curl https://www.flexiquiz.com/api/v1/quizzes/b96ad67c-34c9-4bce-bb2c-076f2619dacd/responses/bf1dd7b8-a908-45bf-bd98-e62831de921a/questions -H "X-API-KEY: fcb7f59c-2a4f-44a9-8281-34cbfd97be99"
Example Response
[{
"question_id": "be1f99f1-913c-4194-b499-f0bb0a332593",
"type": "radio_button",
"version": 1,
"text": "What is 729 x 892",
"use_option_points": false,
"points_scored": 1.00,
"points_available": 1.00,
"options": [
{
"option_id": "7aea2e74-8c39-4052-872f-0fa5b388c979",
"version": 1,
"text": "650172",
"correct": false,
"answer": "",
"selected": false,
"option_points_available": 0
},
{
"option_id": "d09c8a8c-c7f7-4495-aa3b-0f69cbf6cd0a",
"version": 1,
"text": "650268",
"correct": true,
"answer": "",
"selected": true,
"option_points_available": 0
}
],
"categories": [
{
"category_id": "618becb5-3793-4121-b784-3c35d755bcfd",
"name": "Numerical reasoning",
}
]
"files": [
{
"file_id": "bzk2Mzc2YmMzLTc1YjkDE3OS05N2I3LGBjYjlhYzKjbl8wX01hcnMuanBd",
"name": "john.jpg",
}
]
}]
Get an uploaded file
Retreives a file that has been uploaded by a respondent.
The file_id can be retreived from the files section of a responses questions.
GET /v1/quizzes/{quiz_id}/responses/{response_id}/files/{file_id}
Example Request
$ curl https://www.flexiquiz.com/api/v1/quizzes/b96ad67c-34c9-4bce-bb2c-076f2619dacd/responses/bf1dd7b8-a908-45bf-bd98-e62831de921a/files/bzk2Mzc2YmMzLTc1YjkDE3OS05N2I3LGBjYjlhYzKjbl8wX01hcnMuanBd -H "X-API-KEY: fcb7f59c-2a4f-44a9-8281-34cbfd97be99"
Example Response
output file
Get all users
Returns a list of all users in the account.
GET /v1/users
Example Request
$ curl https://www.flexiquiz.com/api/v1/users -H "X-API-KEY: fcb7f59c-2a4f-44a9-8281-34cbfd97be99"
Example Response
[
{
"user_id": "06e3244f-1381-4da4-aa75-996981b42edb",
"user_name": "jemma@flexiquiz.com",
"user_type": "respondent",
"email_address": "jemma@flexiquiz.com",
"first_name": "Jemma",
"last_name": "Patrick",
"organization": "",
"notes": "",
"time_zone": "Mountain Standard Time",
"suspended": false,
"manage_users": false,
"manage_groups": false,
"edit_quizzes": false,
"quizzes": [
{
"quiz_id": "fcb5f59c-2a2f-44a9-8261-33cbfa97be99",
"name": "Economics",
"date_assigned": "2018-10-06 12:15:25"
},
{
"quiz_id": "563db846-0eb4-4b9c-a2ca-21132874275d",
"name": "Geography",
"date_assigned": "2018-10-06 12:15:25"
}
],
"groups": [ ],
"trainerquizzes": [ ],
"trainergroups": [ ],
"date_created": "2018-10-20 10:06:59"
}
]
Get a user
Returns a user.
GET /v1/users/{user_id}
Example Request
$ curl https://www.flexiquiz.com/api/v1/users/06e3244f-1381-4da4-aa75-996981b42edb -H "X-API-KEY: fcb7f59c-2a4f-44a9-8281-34cbfd97be99"
Example Response
{
"user_id": "06e3244f-1381-4da4-aa75-996981b42edb",
"user_name": "jemma@flexiquiz.com",
"user_type": "respondent",
"email_address": "jemma@flexiquiz.com",
"first_name": "Jemma",
"last_name": "Patrick",
"organization": ""
"notes": ""
"time_zone": "Mountain Standard Time",
"suspended": false,
"manage_users": false,
"manage_groups": false,
"edit_quizzes": false,
"quizzes": [
{
"quiz_id": "fcb5f59c-2a2f-44a9-8261-33cbfa97be99",
"name": "Economics",
"date_assigned": "2021-11-12 12:15:25",
"response_id": "bf1ad7b9-b914-55bf-cd17-f62841dd9212",
"date_submitted": "2021-11-14 11:32:41",
"points": 84,
"available_points": 90.00,
"percentage_score": 94,
"grade": "A",
"pass": true,
"duration": 241,
"attempt": 1,
"status": "submitted"
},
{
"quiz_id": "563db846-0eb4-4b9c-a2ca-21132874275d",
"name": "Geography",
"date_assigned": "2021-10-06 12:15:25",
"response_id": "48484bf9-509b-40be-ad46-5b7c9bf0af32",
"date_submitted": "2021-11-14 11:32:41",
"points": 71,
"available_points": 100.00,
"percentage_score": 71,
"grade": "B",
"pass": true,
"duration": 258,
"attempt": 1,
"status": "submitted"
}
],
"groups": [ ],
"trainerquizzes": [ ],
"trainergroups": [ ],
"date_created": "2018-10-20 10:06:59"
}
Find a user
Find a user by the user_name. Returns the user_id
POST /v1/users/find
Example Request
$ curl https://www.flexiquiz.com/api/v1/users/find -H "X-API-KEY: fcb7f59c-2a4f-44a9-8281-34cbfd97be99" -d user_name="jemma@flexiquiz.com" -X POST
Example Response
{
"user_id": "06e3244f-1381-4da4-aa75-996981b42edb"
}
Create a user
Creates a new user.
Parameters
user_name | Unique name that user will use to login. This can also be an email address. |
password | Password to login with. The password must be a minimum of 6 characters. |
user_type | The type of user. Values can be respondent, trainer or administrator. |
email_address | The users email address. |
first_name | The users first name. |
last_name | The users last name. |
suspended | If set to true the user will not be able to login. |
manage_users | View and suspend user accounts assigned through a quiz or group. Create new respondent accounts. (Only applicable for trainer and administrator user types) |
manage_groups | View and edit assigned groups. Create new groups. (Only applicable for trainer and administrator user types) |
edit_quizzes | Create and Edit quizzes, Delete quizzes, View question bank, Configure quizzes, Publish quizzes, View reports. (Only applicable for trainer and administrator user types) |
send_welcome_email | If set to true will send a welcome email to the user with the userame and password. The username must be an email address or the email_address should be set. |
Returns
Returns the user_id of the new user.
POST /v1/users
Example Request
$ curl https://www.flexiquiz.com/api/v1/users -H "X-API-KEY: fcb5f59c-2a2f-44a9-8261-33cbfa97be99" -d user_name="jeff2@flexiquiz.com" -d password="Abdf1245*" -d user_type="respondent" -d email_address="jeff@flexiquiz.com" -d first_name="Jeff" -d last_name="Brady" -d suspended=false -d manage_users=false -d manage_groups=false -d edit_quizzes=false -d send_welcome_email=true
Example Response
{
"user_id": "488cfc9e-dac5-41a6-b71a-1829ca4143f9"
}
Update a user
Updates a new user.
Parameters
All parameters are optional and only included parameters will be updated.
user_name | Unique name that user will use to login. This can also be an email address. |
password | Password to login with. The password must be a minimum of 6 characters. |
user_type | The type of user. Values can be respondent, trainer or administrator. |
email_address | The users email address. |
first_name | The users first name. |
last_name | The users last name. |
suspended | If set to true the user will not be able to login. |
manage_users | View and suspend user accounts assigned through a quiz or group. Create new respondent accounts. (Only applicable for trainer and administrator user types) |
manage_groups | View and edit assigned groups. Create new groups. (Only applicable for trainer and administrator user types) |
edit_quizzes | Create and Edit quizzes, Delete quizzes, View question bank, Configure quizzes, Publish quizzes, View reports. (Only applicable for trainer and administrator user types) |
POST /v1/users/{user_id}
Example Request
$ curl https://www.flexiquiz.com/api/v1/users/488cfc9e-dac5-41a6-b71a-1829ca4143f9 -H "X-API-KEY: fcb5f59c-2a2f-44a9-8261-33cbfa97be99" -d suspended=true
Example Response
{
"message": "200: OK"
}
Delete a user
Deletes a user.
DELETE /v1/users/{user_id}
Example Request
$ curl https://www.flexiquiz.com/api/v1/users/488cfc9e-dac5-41a6-b71a-1829ca4143f9 -H "X-API-KEY: fcb5f59c-2a2f-44a9-8261-33cbfa97be99" -X DELETE
Example Response
{
"message": "200: OK"
}
Get assigned quizzes
Gets a list of all quizzes assigned to a user
GET /v1/users/{user_id}/quizzes
Example Request
$ curl https://www.flexiquiz.com/api/v1/users/06e3244f-1381-4da4-aa75-996981b42edb/quizzes -H "X-API-KEY: fcb5f59c-2a2f-44a9-8261-33cbfa97be99"
Example Response
[
{
"quiz_id": "fcb5f59c-2a2f-44a9-8261-33cbfa97be99",
"name": "Economics",
"date_assigned": "2018-10-06 12:15:25"
},
{
"quiz_id": "563db846-0eb4-4b9c-a2ca-21132874275d",
"name": "Geography",
"date_assigned": "2018-10-06 12:15:25"
}
]
Assign a quiz
Assigns a quiz to a user
POST /v1/users/{user_id}/quizzes
Example Request
$ curl https://www.flexiquiz.com/api/v1/users/06e3244f-1381-4da4-aa75-996981b42edb/quizzes -H "X-API-KEY: fcb5f59c-2a2f-44a9-8261-33cbfa97be99" -d quiz_id="1153af46-9580-4672-af78-f23ce2577a14"
Example Response
{
"message": "200: OK"
}
Unassign a quiz
Unassigns a quiz from a user
DELETE /v1/users/{user_id}/quizzes
Example Request
$ curl https://www.flexiquiz.com/api/v1/users/06e3244f-1381-4da4-aa75-996981b42edb/quizzes -H "X-API-KEY: fcb5f59c-2a2f-44a9-8261-33cbfa97be99" -X "DELETE" -d quiz_id="1153af46-9580-4672-af78-f23ce2577a14"
Example Response
{
"message": "200: OK"
}
Get all groups
Returns a list of all groups in the account
GET /v1/groups
Example Request
$ curl https://www.flexiquiz.com/api/v1/groups -H "X-API-KEY: fcb5f59c-2a2f-44a9-8261-33cbfa97be99"
Example Response
[
{
"group_id": "bcb5f792-4abf-84b1-4162-45ad8a97ba26",
"group_name": "Technology"
},
{
"group_id": "d73da842-0eb4-4b9c-a2ca-241928542751",
"group_name": "Finance"
}
]
Assign a user to a group
POST /v1/users/{user_id}/groups
Example Request
$ curl https://www.flexiquiz.com/api/v1/users/06e3244f-1381-4da4-aa75-996981b42edb/groups -H "X-API-KEY: fcb5f59c-2a2f-44a9-8261-33cbfa97be99" -d group_id="bcb5f792-4abf-84b1-4162-45ad8a97ba26"
Example Response
{
"message": "200: OK"
}
Unassign a user from a group
DELETE /v1/users/{user_id}/groups
Example Request
$ curl https://www.flexiquiz.com/api/v1/users/06e3244f-1381-4da4-aa75-996981b42edb/groups -H "X-API-KEY: fcb5f59c-2a2f-44a9-8261-33cbfa97be99" -X "DELETE" -d group_id="bcb5f792-4abf-84b1-4162-45ad8a97ba26"
Example Response
{
"message": "200: OK"
}
Get groups in a quiz
Returns a list of all groups assigned to a quiz
GET /v1/quizzes/{quiz_id}/groups
Example Request
$ curl https://www.flexiquiz.com/api/v1/quizzes/b96ad67c-34c9-4bce-bb2c-076f2619dacd/groups -H "X-API-KEY: fcb5f59c-2a2f-44a9-8261-33cbfa97be99"
Example Response
[
{
"group_id": "bcb5f792-4abf-84b1-4162-45ad8a97ba26",
"group_name": "Technology"
},
{
"group_id": "d73da842-0eb4-4b9c-a2ca-241928542751",
"group_name": "Finance"
}
]
Assign a quiz to a group
POST /v1/quizzes/{quiz_id}/groups
Example Request
$ curl https://www.flexiquiz.com/api/v1/quizzes/b96ad67c-34c9-4bce-bb2c-076f2619dacd/groups -H "X-API-KEY: fcb5f59c-2a2f-44a9-8261-33cbfa97be99" -d group_id="bcb5f792-4abf-84b1-4162-45ad8a97ba26"
Example Response
{
"message": "200: OK"
}
Unassign a quiz from a group
DELETE /v1/quizzes/{quiz_id}/groups
Example Request
$ curl https://www.flexiquiz.com/api/v1/quizzes/b96ad67c-34c9-4bce-bb2c-076f2619dacd/groups -H "X-API-KEY: fcb5f59c-2a2f-44a9-8261-33cbfa97be99" -X "DELETE" -d group_id="bcb5f792-4abf-84b1-4162-45ad8a97ba26"
Example Response
{
"message": "200: OK"
}