Update a variant

Updates a variant. Only the fields you send are changed, with one exception: changing language to a different language or project template clears the variant's starter files, since code written for one environment does not fit another. The variant then opens with the new language's default code or the project template's own files. To keep starter code, send contents or file_contents in the same request. The solution is kept.

file_contents replaces all of the variant's files. An empty array resets a project template variant to the template's own files.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Path Params
integer
required

The question ID.

integer
required

The variant ID.

Body Params
string

A language key or a project template slug.

string | null

Starter code, for single-file language variants. An empty string is a blank starter file; null uses the language's default code. Cannot be combined with file_contents.

file_contents
array of objects

Starter files. deleted is only used on creation, for project template variants.

file_contents
string | null

Reference solution for this variant. null clears the solution.

Responses

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