The flag submission API lets authenticated participants submit answers to challenges and receive immediate feedback. A correct submission records the solve, awards points to the user’s total score, and applies any hint penalties accrued during the attempt. Practice mode lets you re-attempt challenges you have already solved without affecting your score.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/flagForgeCTF/flagForge/llms.txt
Use this file to discover all available pages before exploring further.
POST /api/problems/[id]
Submit a flag for a challenge. Requires an active session.Path parameters
The MongoDB
_id of the challenge you are submitting a flag for.Query parameters
Set to
true to submit in practice mode. Practice mode is only active if you have already solved the challenge. Your score is not affected — practice submissions never create a new UserQuestion record.Request body
The flag string to validate. Leading and trailing whitespace is trimmed before comparison.
Response fields
The response shape varies depending on the outcome. Correct flag (first solve):"Right! Congratulations on solving the challenge!"Points awarded for this solve, after any hint penalties have been deducted.
truetrue"Incorrect flag. Try again!"falsefalse"You have already solved this challenge!""Practice mode: Correct flag."truetrue"Practice mode: Incorrect flag. Try again!"falsetrueError responses
| Status | Condition |
|---|---|
401 Unauthorized | You are not signed in. |
404 Not Found | No challenge exists with the given id. |
410 Gone | The challenge has expired and no longer accepts submissions. |
How points and hints interact
Hint deductions are applied immediately when a hint is unlocked viaPOST /api/problems/[id]/hints — they are not re-applied at submission time. The points field in the success response is the challenge’s full base point value. The net effect on a player’s score is the sum of hint deductions (already applied) plus the base points added on solve.
Examples
Submit a flag:Dynamic flags and the flag generator
The codebase includes autils/flagGenerator.ts utility that implements per-user dynamic flag generation. This powers challenges where the flag template in the database contains a marker like [GUID], [TEAM_HASH], [LEET], or [CLEET]. The generator is called internally when the admin creates a challenge with a dynamic flag template.
See Dynamic flags for a full explanation of the four flag types and how they work from the player’s perspective.
GET /api/problems/[id]/hints
Retrieve hints for a challenge. Requires an active session. Accessing a hint records the usage against your account and deducts points from your score for that challenge before the flag is submitted.Path parameters
The MongoDB
_id of the challenge.Response fields
Array of hint objects for this challenge. Locked hints have
text: null; unlocked hints include the full text.Array of hint indices the authenticated user has already unlocked for this challenge.
Example
POST /api/problems/[id]/hints
Unlock a specific hint for a challenge. Requires an active session. Deducts the hint’spointsDeduction from the user’s total score immediately on unlock. Cannot be used if the challenge is already solved.
Path parameters
The MongoDB
_id of the challenge.Request body
Zero-based index of the hint to unlock. Use the
index field from GET /api/problems/[id]/hints to determine the correct value.Response fields
Confirmation message including the hint text and points deducted.
The revealed hint text.
Points subtracted from the user’s total score for this hint reveal.
true on success.