Create a question

Creates a question in your question bank.

  • For a single-file language, send the starter code in contents.
  • For a project template (for example multifile_python or react), set language to the template slug and send the files either:
    • in file_contents: the files replace the template files with the same path or are added, and the other template files are kept. "deleted": true removes a template file. A binary file (PDF, JPEG, PNG or .xlsx spreadsheet, up to 20 MB) is sent with its bytes base64-encoded in contents and "encoding": "base64".
    • as a zip archive in zip_file (multipart request): the archive replaces all the template files, except the template's .cpad configuration file, which is kept unless the archive has one. A single enclosing folder is removed from the paths.
  • html creates a question on the HTML project template: send file_contents or zip_file, not contents.

For project template questions, the response's language is the template slug, and its file_contents is an array of the question's files, with the template files it removed marked "deleted": true and binary files marked "binary": true without their contents.

With is_draft: true, the question is saved as a draft: the fields a published question needs, such as the starter code, can be left out and completed before publishing it from the question bank. A question's draft state can only be set on creation.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Body Params
question
object
required
Headers
string
enum
Defaults to application/json

Generated from available request content types

Allowed:
Responses

409

A scoped question-generation credential refers to a discarded or otherwise unavailable request.

502

A binary file in file_contents could not be stored. Nothing was created; retry the request.

Language
Credentials
Bearer
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json