Skip to content
API documentation
View as MarkdownOpen in Claude

Applications

Enter one of your students for an exam

POST
/v1/{organizationId}/application

Enters one of your students for one exam in this organization, and creates the payment record the application is paid through.

Before you call it: register the student (registerStudent), have them sign in to this organization once through a sign-in link (createSigninLink), which creates the organization’s own record of them, and pick the exam from listAvailableExams: a leaf’s matchedExam._id is the examId to send. An exam that list leaves out for this student is refused here too.

Checks, in order. The first that fails decides the answer.

  1. The student is yours (404). Your students are the ones your account registered; anyone else’s answers like an unknown id.
  2. The organization holds a record of the student (409).
  3. The exam exists in this organization (404).
  4. The exam is offered to this student: it is open, and it fits their grade (400 for a student with no grade), their country and has a language (409, naming the rule).
  5. The student already has this exact exam: 200 "Application already exists." with that application, and nothing is created. If you sent an externalRef and the application has none yet, it is set; if it already has a different one, 409.
  6. The student holds no other exam in the same category on the same sitting (409). On hilingua the sitting is checked by language instead, and by category only when it is held in the student’s local time.

externalRef is your own reference for the application, such as the order or invoice number you collected the fee under. It is kept on the application, returned by every application read, and the lists can be filtered by it. Once set it does not change.

Side effects. A payment record for the exam’s price (on coding, the bundle price: 15 or 30 once the student has paid a CodeCombat or Codementum exam this season): paid with amount 0 for a free exam, pending otherwise. This API never refunds money. An application for a make-up sitting is removed automatically 6 hours after it is made (see removeAfter).

walletPay: true pays the application from your wallet in the same call. A priced exam takes one credit of this organization; a free exam takes none. The application, its payment and the debit happen together or not at all, so a refused payment leaves no pending application behind. Needs the application/pay permission and an enabled wallet. A repeat call with walletPay: true pays a payment that is still pending. data.wallet says what was taken. See the wallet guide.

Safe to retry for the same student and exam, with the same externalRef or none: a repeat answers 200 with the application already there. Only while the exam is still offered to the student, though, because check 4 runs first: once the sitting date has passed, a repeat answers 409 and leaves the existing application as it was.

data is the application as stored. exam, payment and user are ids, and user is the organization’s own id for the student, not your studentId; getApplication resolves them.

Parameters

Path parameters

NameTypeDescription
organizationIdrequiredstringpattern ^[0-9a-f]{24}$

The organization’s _id: 24 hexadecimal digits, as listOrganizations (GET /v1/organization) lists it.

Example 64b7f0c2a1d3e4f5a6b7c8d9

Request body

application/jsonrequired

  • examIdstringrequired

    The exam’s _id in this organization, 24 hexadecimal digits: a listAvailableExams leaf’s matchedExam._id, or an _id from listExams. It has to be an exam listAvailableExams offers this student.

    example6650a1b2c3d4e5f6a7b8c9e1

  • studentIdstringrequired

    The student’s _id, 24 hexadecimal digits: the id registerStudent returned. It has to be one of your students, the ones your account registered.

    example6650a1b2c3d4e5f6a7b8c9d0

  • externalRefstring

    Your own reference for this application, such as your order or invoice number, kept on the application and returned with it. Trimmed; at most 64 characters, no control characters or line breaks. Not required to be unique. Filter the application lists by it with ?externalRef=. Once set it cannot be changed: a repeat of this request with a different externalRef is 409, and a repeat for an application that has none sets it.

    max length64exampleINV-2026-0042

  • walletPayboolean

    Pay the application from your wallet in the same call. The wallet is not self-service: Main Team opens it only after an agreement and on your request (info@main-team.org). One credit of this organization for a priced exam, none for a free one. Needs the application/pay permission and an enabled wallet (403 wallet_not_enabled otherwise, even when no credit would be taken), and enough credits (409 insufficient_credits). The application, its payment and the debit are written together or not at all. A repeat of the call pays a payment that is still pending, and answers charged: false for one already paid from the wallet. Left out or false, the payment stays pending.

    defaultfalseexampletrue

Responses

200 OK

Nothing new had to be created: message is "Application already exists.".

Body

  • successbooleanrequired

    Always true on a success.

    one oftrue

  • messagestringrequired

    exampleApplication already exists.

  • dataobject · CreateApplicationRecordResponserequired

    The application as stored, as createApplication answers it, and with wallet when the request sent walletPay: true.

    18 fields of data
    • _idstringrequired

      The application’s id: what applicationId takes.

      example6650a1b2c3d4e5f6a7b8c9e5

    • examstringrequired

      The id of the exam applied for.

      example6650a1b2c3d4e5f6a7b8c9e1

    • userstringrequired

      The organization’s own id for the student, not the id you registered them with. The application reads resolve it into a record carrying both.

      example6650a1b2c3d4e5f6a7b8c9e9

    • paymentstring

      The id of the application’s payment.

      example6650a1b2c3d4e5f6a7b8c9e6

    • partnersarray of ApplicationPartnerResponserequired

      On a team exam, the other members of the team. Empty for an exam sat alone.

      2 fields of each item
      • userstring

        The team member’s id in this organization. Not one of your students’ ids, and not resolved.

        example6650a1b2c3d4e5f6a7b8c9d6

      • acceptedboolean

        Whether they have accepted the invitation to the team.

        exampletrue

    • participatedbooleanrequired

      Whether the student has started the exam. A started application cannot be moved to another exam.

      examplefalse

    • examStartstring

      When the student started the exam; absent until then.

      formatdate-timeexample2026-11-14T10:04:12.000Z

    • examSubmittedboolean

      Whether the student has handed the exam in. A handed-in application cannot be moved to another exam.

      examplefalse

    • submitDatestring

      When the student handed the exam in; absent until then.

      formatdate-timeexample2026-11-14T11:12:40.000Z

    • simulationStartedbooleanrequired

      Whether the student has started the practice run.

      examplefalse

    • simulationStartstring

      When the student started the practice run; absent until then.

      formatdate-timeexample2026-11-07T10:00:00.000Z

    • simulationSubmittedbooleanrequired

      Whether the student has handed the practice run in.

      examplefalse

    • removeAfterstring

      Only on an application to an exam on a make-up sitting: when it will be removed, 6 hours after it was made.

      formatdate-timeexample2026-09-02T14:05:00.000Z

    • uuidstringrequired

      A short reference code for the application.

      examplea3f-09c-7e1

    • externalRefstring

      Your own reference for the application, as you gave it to createApplication; absent when you gave none. Filter the lists by it with ?externalRef=.

      exampleINV-2026-0042

    • createdAtstringrequired

      When the application was made.

      formatdate-timeexample2026-09-01T09:30:00.000Z

    • updatedAtstringrequired

      When the application last changed.

      formatdate-timeexample2026-09-02T14:05:00.000Z

    • walletobject · WalletChargeResponse

      Present only when the request sent walletPay: true: what the wallet did for this application.

      7 fields of wallet
      • chargedbooleanrequired

        true when a credit was taken by this call. false when there was nothing to take: see reason.

        exampletrue

      • reasonstring

        Why nothing was taken, only when charged is false. free: the exam costs nothing, and a free exam never uses a credit. already_paid: this wallet already paid it, in an earlier call; reference and entryId are that payment’s.

        one offreealready_paid

        examplefree

      • amountnumberrequired

        The amount the payment was settled at, in cents: the exam’s price, or the coding bundle price when it is lower. 0 for a free exam.

        example5000

      • currencystringrequired

        The currency of amount: USD for neo, EUR otherwise.

        one ofEURUSD

        exampleEUR

      • referencestring

        The transaction code of the payment (stx-...), the same reference the application reads show on a settled payment.

        examplestx-19a2c3d4e5f6a7b8c9

      • entryIdstring

        The _id of the wallet entry (listWalletEntries).

        example6650a1b2c3d4e5f6a7b8c9f2

      • remainingnumberrequired

        Credits left for this organization after the call (granted minus spent).

        example41

Headers

X-RateLimit-Limit integer

Requests your account may make to this operation per window (100).

X-RateLimit-Remaining integer

Requests left in the current window.

X-RateLimit-Reset integer

Seconds until the current window ends.

Example

{
  "success": true,
  "message": "Application already exists.",
  "data": {
    "_id": "6650a1b2c3d4e5f6a7b8c9e5",
    "exam": "6650a1b2c3d4e5f6a7b8c9e1",
    "user": "6650a1b2c3d4e5f6a7b8c9e9",
    "payment": "6650a1b2c3d4e5f6a7b8c9e6",
    "partners": [
      {
        "user": "6650a1b2c3d4e5f6a7b8c9d6",
        "accepted": true
      }
    ],
    "participated": false,
    "examStart": "2026-11-14T10:04:12.000Z",
    "examSubmitted": false,
    "submitDate": "2026-11-14T11:12:40.000Z",
    "simulationStarted": false,
    "simulationStart": "2026-11-07T10:00:00.000Z",
    "simulationSubmitted": false,
    "removeAfter": "2026-09-02T14:05:00.000Z",
    "uuid": "a3f-09c-7e1",
    "externalRef": "INV-2026-0042",
    "createdAt": "2026-09-01T09:30:00.000Z",
    "updatedAt": "2026-09-02T14:05:00.000Z",
    "wallet": {
      "charged": true,
      "reason": "free",
      "amount": 5000,
      "currency": "EUR",
      "reference": "stx-19a2c3d4e5f6a7b8c9",
      "entryId": "6650a1b2c3d4e5f6a7b8c9f2",
      "remaining": 41
    }
  }
}

Example request

# $TOKEN: a short-lived token you minted with your API key and secret
curl -sS -X POST 'https://api.main-team.org/v1/<organizationId>/application' \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  --data-binary @- <<'JSON'
{
  "examId": "6650a1b2c3d4e5f6a7b8c9e1",
  "studentId": "6650a1b2c3d4e5f6a7b8c9d0",
  "externalRef": "INV-2026-0042",
  "walletPay": true
}
JSON

Search the API documentation

Guides, endpoints by name, path or permission, and error codes such as not_found.