CoderPad Question variants API

The starter code of a question that can be taken in several languages or project templates. A question with variants has no language of its own; each variant carries one.

Operations 5

GET /questions/{question_id}/variants List the variants of a question #
POST /questions/{question_id}/variants Create a variant #
GET /questions/{question_id}/variants/{id} Retrieve a variant #
PUT /questions/{question_id}/variants/{id} Update a variant #
DELETE /questions/{question_id}/variants/{id} Delete a variant #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/coderpad:coderpad-question-variants-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

coderpad-question-variants-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: CoderPad Interview Question variants API
  version: 1.0.0
  description: 'The CoderPad Interview API lets you create and manage interview pads and questions programmatically, for example to integrate CoderPad with your interview scheduling platform or to retrieve the content of an interview once it has ended.


    It is a REST API that returns JSON.


    # Authentication


    Every request is authenticated with your API key, which you can find on your settings page. Send it in the `Authorization` header, either as a bearer token or in the `Token` format:


    ```

    curl -H ''Authorization: Bearer YOUR_API_KEY'' https://app.coderpad.io/api/pads

    curl -H ''Authorization: Token token="YOUR_API_KEY"'' https://app.coderpad.io/api/pads

    ```


    # Responses and errors


    Every response is a JSON object. Successful responses have an HTTP 2xx status and include `"status": "OK"`. Unsuccessful responses have an appropriate HTTP status and include `"status": "ERROR"` and a human-readable `message`:


    ```json

    { "status": "ERROR", "message": "Invalid API key" }

    ```


    | HTTP status | Meaning |

    | --- | --- |

    | 200 | The request succeeded. |

    | 400 | The request is invalid, for example because it specifies a language that does not exist. |

    | 401 | The API key is not tied to a valid account, or you cannot access this resource. |

    | 403 | You do not have permission to perform this action. |

    | 404 | The resource does not exist or is not visible to you. |

    | 429 | Too many requests, or your pad quota is exhausted. |


    # Request bodies


    Requests can be sent as JSON or as form data. Write endpoints expect their fields wrapped in an object named after the resource (`{"pad": {"title": "..."}}`, `question[title]=...`), but also accept them at the top level (`{"title": "..."}`, `title=...`).


    # Pagination


    List endpoints return at most 50 items per request, along with a `total` count. Follow the `next_page` and `prev_page` URLs, when present, to fetch the other pages.


    # Languages


    Wherever a request or response has a `language` field, its value is a CoderPad language key such as `python3`, `javascript`, `typescript`, `java`, `ruby`, `go`, `csharp`, `cpp` or `postgresql`. Where noted, project template slugs (multi-file environments such as `react` or `multifile_python`) are also accepted.'
  contact:
    name: CoderPad Support
    url: https://coderpad.io/support/
servers:
- url: https://app.coderpad.io/api
security:
- apiKey: []
tags:
- name: Question variants
  description: The starter code of a question that can be taken in several languages or project templates. A question with variants has no language of its own; each variant carries one.
paths:
  /questions/{question_id}/variants:
    parameters:
    - $ref: '#/components/parameters/VariantQuestionId'
    get:
      tags:
      - Question variants
      operationId: listQuestionVariants
      summary: List the variants of a question
      description: Returns every variant of the question in a single response. Unlike the other list endpoints, this one is not paginated and has no `total` count or `next_page` / `prev_page` URLs. A single-environment question has no variants and returns an empty list.
      responses:
        '200':
          description: The variants of the question.
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/Ok'
                - type: object
                  required:
                  - variants
                  properties:
                    variants:
                      type: array
                      items:
                        $ref: '#/components/schemas/QuestionVariant'
        '400':
          $ref: '#/components/responses/QuestionsDisabled'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    post:
      tags:
      - Question variants
      operationId: createQuestionVariant
      summary: Create a variant
      description: 'Adds a language or project template variant to a question.


        For a project template variant, the files you send in `file_contents` are merged over the template''s files: a file replaces the template file with the same path, and `"deleted": true` drops a template file. `.cpad` cannot be deleted, and at least one file must remain.'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              allOf:
              - $ref: '#/components/schemas/QuestionVariantWriteRequest'
              - required:
                - language
            example:
              language: ruby
              contents: 'def two_sum(numbers, target)

                end

                '
      responses:
        '200':
          description: The created variant.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuestionVariantResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  /questions/{question_id}/variants/{id}:
    parameters:
    - $ref: '#/components/parameters/VariantQuestionId'
    - name: id
      in: path
      required: true
      description: The variant ID.
      schema:
        type: integer
    get:
      tags:
      - Question variants
      operationId: getQuestionVariant
      summary: Retrieve a variant
      responses:
        '200':
          description: The variant.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuestionVariantResponse'
        '400':
          $ref: '#/components/responses/QuestionsDisabled'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    put:
      tags:
      - Question variants
      operationId: updateQuestionVariant
      summary: Update a variant
      description: '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.'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QuestionVariantWriteRequest'
            example:
              solution: "def two_sum(numbers, target)\n  # ...\nend\n"
      responses:
        '200':
          description: The updated variant.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuestionVariantResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    delete:
      tags:
      - Question variants
      operationId: deleteQuestionVariant
      summary: Delete a variant
      responses:
        '200':
          description: The variant was deleted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ok'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    FileContent:
      type: object
      required:
      - path
      properties:
        path:
          type: string
          example: src/App.jsx
        contents:
          type: string
        hidden:
          type: boolean
          description: Hide the file from the candidate.
    QuestionVariantResponse:
      allOf:
      - $ref: '#/components/schemas/Ok'
      - $ref: '#/components/schemas/QuestionVariant'
    Ok:
      type: object
      required:
      - status
      properties:
        status:
          type: string
          enum:
          - OK
    QuestionVariant:
      type: object
      properties:
        id:
          type: integer
        question_id:
          type: integer
        language:
          type:
          - string
          - 'null'
          description: The variant language. `null` for project template variants.
        project_template_id:
          type:
          - integer
          - 'null'
        project_template_slug:
          type:
          - string
          - 'null'
        display:
          type: string
          description: Display name of the variant's language or project template.
        solution:
          type:
          - string
          - 'null'
        contents:
          type:
          - string
          - 'null'
          description: Starter code of single-file language variants. `null` for project template variants.
        file_contents:
          type: array
          description: 'The variant''s starter files, in the shape `file_contents` takes on creation. For a project template variant, each template file the variant removed is listed with `"deleted": true`. Empty when a project template variant opens with the unmodified template files.

            '
          items:
            allOf:
            - $ref: '#/components/schemas/FileContent'
            - type: object
              properties:
                deleted:
                  type: boolean
        created_at:
          $ref: '#/components/schemas/Timestamp'
        updated_at:
          $ref: '#/components/schemas/Timestamp'
    Timestamp:
      type: string
      format: date-time
      example: '2026-09-30T14:02:11Z'
    QuestionVariantWriteRequest:
      type: object
      properties:
        language:
          type: string
          description: A language key or a project template slug.
        contents:
          type:
          - string
          - 'null'
          description: '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:
          type: array
          description: Starter files. `deleted` is only used on creation, for project template variants.
          items:
            allOf:
            - $ref: '#/components/schemas/FileContent'
            - type: object
              properties:
                deleted:
                  type: boolean
        solution:
          type:
          - string
          - 'null'
          description: Reference solution for this variant. `null` clears the solution.
    Error:
      type: object
      required:
      - status
      - message
      properties:
        status:
          type: string
          enum:
          - ERROR
        message:
          type: string
          description: A human-readable description of the error.
  responses:
    NotFound:
      description: The resource does not exist or is not visible to you.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: ERROR
            message: Pad not found
    BadRequest:
      description: The request is malformed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: ERROR
            message: 'Bad request: invalid language'
    Unauthorized:
      description: The API key is invalid, or you cannot access this resource.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: ERROR
            message: Invalid API key
    Forbidden:
      description: You do not have permission to perform this action.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: ERROR
            message: Unauthorized question access.
    QuestionsDisabled:
      description: The question bank is disabled for your organization.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  parameters:
    VariantQuestionId:
      name: question_id
      in: path
      required: true
      description: The question ID.
      schema:
        type: integer
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: 'Your API key, from [your settings page](https://app.coderpad.io/settings). The `Authorization: Token token="YOUR_API_KEY"` format is also accepted.

        '
x-provenance:
  method: searched
  source: https://developers.coderpad.io/reference
  harvested: '2026-10-27'
  tool: harvest-readme-openapi.py
  note: Assembled verbatim from the OpenAPI definition ReadMe embeds in each operation page of the provider's developer portal; paths and components merged by API title, nothing authored.
  assembled_from:
  - https://developers.coderpad.io/reference/createpad.md
  - https://developers.coderpad.io/reference/createquestion-1.md
  - https://developers.coderpad.io/reference/createquestionvariant.md
  - https://developers.coderpad.io/reference/deletequestion.md
  - https://developers.coderpad.io/reference/deletequestionvariant.md
  - https://developers.coderpad.io/reference/getorganization.md
  - https://developers.coderpad.io/reference/getorganizationstats.md
  - https://developers.coderpad.io/reference/getpad.md
  - https://developers.coderpad.io/reference/getpadenvironment.md
  - https://developers.coderpad.io/reference/getquestion.md
  - https://developers.coderpad.io/reference/getquestionvariant.md
  - https://developers.coderpad.io/reference/getquota.md
  - https://developers.coderpad.io/reference/getuser.md
  - https://developers.coderpad.io/reference/listorganizationpads.md
  - https://developers.coderpad.io/reference/listorganizationquestions.md
  - https://developers.coderpad.io/reference/listorganizationusers.md
  - https://developers.coderpad.io/reference/listpadevents.md
  - https://developers.coderpad.io/reference/listpads.md
  - https://developers.coderpad.io/reference/listquestions.md
  - https://developers.coderpad.io/reference/listquestionvariants.md
  - https://developers.coderpad.io/reference/updatepad.md
  - https://developers.coderpad.io/reference/updatequestion-1.md
  - https://developers.coderpad.io/reference/updatequestionvariant.md
  merge:
    pages: 23
    deduped: 211
    conflicts_kept_first: 0