rCTF Docs

Integrations

Client config, analytics, CTFtime, instancer, and admin bot participant routes.

Integration routes help the web app and external services coordinate with rCTF. They cover public runtime config, analytics script delivery, CTFtime handoff, per team challenge instances, and participant admin bot jobs.

The admin bot worker service routes use a separate service token and are documented in Admin.

Version choice#

Client config is available in both V1 and V2. Newer clients usually want V2 because it includes the current analytics, captcha, logo, archive, and instancer fields. The remaining integration routes are version specific.

Timeline behavior#

Instance and participant admin bot routes open after the CTF starts. Admins with challsRead can read through that start gate when they need to review challenges before the event begins.

GET Client config

GET /api/[v2,v1]/integrations/client/config

Auth
Public
Gate
None
Permissions
No extra permissions
Captcha
No captcha
Rate limit
No rate limit

This route provides the public runtime settings used by the web app. It includes display settings, event timing, registration state, division names, and public provider settings.

V2 includes the current captcha and analytics fields, logo URLs, archive state, and instancer availability. V1 remains available for older clients and includes the older globalSiteTag and recaptcha fields.

Response fields

meta.descriptionstring
Returned meta description value.
meta.imageUrlstring
Returned meta image url value.
homeContentstring
Returned home content value.
sponsors[].namestring
Display name.
sponsors[].iconstring
Returned sponsors icon value.
sponsors[].descriptionstring
Returned sponsors description value.
sponsors[].urlstring | undefined
Resource URL.
flagFormatPlaceholderstring
Returned flag format placeholder value.
analytics.providerstring
Returned analytics provider value.
analytics.publicOptionsRecord<string, string>
Returned analytics public options value.
ctfNamestring
Returned ctf name value.
divisionsRecord<string, string>
Returned divisions value.
defaultDivisionstring | null | undefined
Returned default division value.
originstring
Returned origin value.
startTimenumber
Returned start time value.
endTimenumber
Returned end time value.
userMembersboolean
Returned user members value.
faviconUrlstring | null
Returned favicon url value.
logoLightUrlstring | null
Returned logo light url value.
logoDarkUrlstring | null
Returned logo dark url value.
emailEnabledboolean
Returned email enabled value.
registrationsEnabledboolean | null
Returned registrations enabled value.
ctftime.clientIdtransform
Returned ctftime client id value.
instancerEnabledboolean
Returned instancer enabled value.
isArchivedboolean
Returned is archived value.
captcha.providerstring
Returned captcha provider value.
captcha.publicOptionsRecord<string, string>
Returned captcha public options value.
captcha.protectedEndpointsRecord<"register" | "recover" | "setEmail" | "instancerStart" | "instancerExtend" | "avatarUpload" | "adminBotSubmit", boolean>
Returned captcha protected endpoints value.

Response fields

meta.descriptionstring
Returned meta description value.
meta.imageUrlstring
Returned meta image url value.
homeContentstring
Returned home content value.
sponsors[].namestring
Display name.
sponsors[].iconstring
Returned sponsors icon value.
sponsors[].descriptionstring
Returned sponsors description value.
sponsors[].urlstring | undefined
Resource URL.
globalSiteTagstring | null | undefined
Returned global site tag value.
ctfNamestring
Returned ctf name value.
divisionsRecord<string, string>
Returned divisions value.
defaultDivisionstring | null | undefined
Returned default division value.
originstring
Returned origin value.
startTimenumber
Returned start time value.
endTimenumber
Returned end time value.
userMembersboolean
Returned user members value.
faviconUrlstring | null
Returned favicon url value.
emailEnabledboolean
Returned email enabled value.
registrationsEnabledboolean | null
Returned registrations enabled value.
ctftime.clientIdtransform
Returned ctftime client id value.
recaptcha.siteKeystring
Returned recaptcha site key value.
recaptcha.protectedActionsstring[]
Returned recaptcha protected actions value.

GET Analytics script

GET /api/v2/integrations/analytics/script

Auth
Public
Gate
None
Permissions
No extra permissions
Captcha
No captcha
Rate limit
No rate limit

This route proxies the active analytics provider script when analytics are configured. It is intentionally not part of @rctf/types, because it returns JavaScript rather than an rCTF response body.

Response#

The response body is the provider JavaScript. The API keeps the fetched script in memory for one hour.

When analytics are not configured, the route responds with 404. Upstream fetch failures respond with 502.

GET Instance status

GET /api/v2/integrations/challs/:id/instance

Auth
Required
Gate
Started (bypass challsRead)
Permissions
No extra permissions
Captcha
No captcha
Rate limit
No rate limit

This route gives the authenticated team’s current instance state for a challenge. It is used to show whether the instance is stopped, starting, running, stopping, or in an error state.

When no instancer provider is configured, or when the challenge has no instancer settings, the route returns 404 badEndpoint. Provider errors return 400 badInstancerError with a provider message.

Path parameters

id requiredstring
Unique identifier.

Response fields

status"stopped" | "running" | "starting" | "stopping" | "errored"
Returned status value.
timeLeftMillisecondsnumber | null
Returned time left milliseconds value.
endpoints[].kind"tcp" | "tcp-ssl" | "http" | "https"
Response or object kind.
endpoints[].hoststring
Returned endpoints host value.
endpoints[].portnumber
Returned endpoints port value.
endpoints[].titlestring | undefined
Returned endpoints title value.

endpoints are returned in the order configured for the challenge. Endpoint kinds include tcp, tcp-ssl, http, and https.

PUT Start an instance

PUT /api/v2/integrations/challs/:id/instance

Auth
Required
Gate
Started (bypass challsRead)
Permissions
No extra permissions
Captcha
instancerStart
Rate limit
No rate limit

This route asks the instancer provider to start an instance for the authenticated team. If the provider needs time to finish provisioning, the response can report starting before a later status request reports running.

Captcha is checked only when the deployment protects instancerStart.

Path parameters

id requiredstring
Unique identifier.

Request body

captchaCodestring
Captcha challenge token.

Response fields

status"stopped" | "running" | "starting" | "stopping" | "errored"
Returned status value.
timeLeftMillisecondsnumber | null
Returned time left milliseconds value.
endpoints[].kind"tcp" | "tcp-ssl" | "http" | "https"
Response or object kind.
endpoints[].hoststring
Returned endpoints host value.
endpoints[].portnumber
Returned endpoints port value.
endpoints[].titlestring | undefined
Returned endpoints title value.

PATCH Extend an instance

PATCH /api/v2/integrations/challs/:id/instance

Auth
Required
Gate
Started (bypass challsRead)
Permissions
No extra permissions
Captcha
instancerExtend
Rate limit
No rate limit

This route asks the instancer provider to extend the authenticated team’s running instance. The returned status includes the updated remaining time when the provider reports one.

Captcha is checked only when the deployment protects instancerExtend.

Path parameters

id requiredstring
Unique identifier.

Request body

captchaCodestring
Captcha challenge token.

Response fields

status"stopped" | "running" | "starting" | "stopping" | "errored"
Returned status value.
timeLeftMillisecondsnumber | null
Returned time left milliseconds value.
endpoints[].kind"tcp" | "tcp-ssl" | "http" | "https"
Response or object kind.
endpoints[].hoststring
Returned endpoints host value.
endpoints[].portnumber
Returned endpoints port value.
endpoints[].titlestring | undefined
Returned endpoints title value.

DELETE Stop an instance

DELETE /api/v2/integrations/challs/:id/instance

Auth
Required
Gate
Started (bypass challsRead)
Permissions
No extra permissions
Captcha
No captcha
Rate limit
No rate limit

This route asks the instancer provider to stop the authenticated team’s instance. The response reports the latest state returned by the provider.

Path parameters

id requiredstring
Unique identifier.

Response fields

status"stopped" | "running" | "starting" | "stopping" | "errored"
Returned status value.
timeLeftMillisecondsnumber | null
Returned time left milliseconds value.
endpoints[].kind"tcp" | "tcp-ssl" | "http" | "https"
Response or object kind.
endpoints[].hoststring
Returned endpoints host value.
endpoints[].portnumber
Returned endpoints port value.
endpoints[].titlestring | undefined
Returned endpoints title value.

GET Admin bot config

GET /api/v2/integrations/challs/:id/admin-bot/config

Auth
Public
Gate
Started (bypass challsRead)
Permissions
No extra permissions
Captcha
No captcha
Rate limit
No rate limit

This route gives participants the released admin bot challenge source and the file extension for that source. Challenge authors can use this to show the exact code participants will write against.

Path parameters

id requiredstring
Unique identifier.

Response fields

sourceCodestring
Returned source code value.
fileExtensionstring
Returned file extension value.

POST Submit admin bot job

POST /api/v2/integrations/challs/:id/admin-bot

Auth
Required
Gate
Started (bypass challsRead)
Permissions
No extra permissions
Captcha
adminBotSubmit
Rate limit
Burst 1, refill window 10000 ms per user and challenge.

This route submits an admin bot job for the authenticated team. Participants send values for the input names configured on the challenge.

Only one queued or running job is allowed per user and challenge. When the challenge depends on a running instance, the route returns 400 badInstancerState if the instance is missing, stopped, or expires before the admin bot timeout.

Path parameters

id requiredstring
Unique identifier.

Request body

inputs requiredrecord
Request body field for inputs.
captchaCodestring
Captcha challenge token.

Response fields

jobIdstring
Job identifier.

GET Admin bot job status

GET /api/v2/integrations/challs/:id/admin-bot/status

Auth
Required
Gate
Started (bypass challsRead)
Permissions
No extra permissions
Captcha
No captcha
Rate limit
No rate limit

This route gives the authenticated team’s active admin bot job for a challenge. The job field is null when there is no queued or running job.

Path parameters

id requiredstring
Unique identifier.

Response fields

job.idstring
Unique identifier.
job.status"queued" | "running" | "completed" | "failed"
Returned job status value.
job.createdAtstring
Creation timestamp.
job.queuePositionnumber | null
Returned job queue position value.
job.logsstring | null
Returned job logs value.

GET Admin bot job history

GET /api/v2/integrations/challs/:id/admin-bot/history

Auth
Required
Gate
Started (bypass challsRead)
Permissions
No extra permissions
Captcha
No captcha
Rate limit
No rate limit

This route gives the retained completed and failed admin bot jobs for the authenticated team on a challenge. It is useful for showing recent submissions without including the full log body in the list.

Path parameters

id requiredstring
Unique identifier.

Response fields

jobs[].idstring
Unique identifier.
jobs[].status"queued" | "running" | "completed" | "failed"
Returned jobs status value.
jobs[].createdAtstring
Creation timestamp.
jobs[].hasLogsboolean
Returned jobs has logs value.

GET Admin bot job logs

GET /api/v2/integrations/challs/:id/admin-bot/jobs/:jobId/logs

Auth
Required
Gate
Started (bypass challsRead)
Permissions
No extra permissions
Captcha
No captcha
Rate limit
No rate limit

This route gives the retained logs for a completed or failed admin bot job. The logs field is null when logs are not available.

Path parameters

id requiredstring
Unique identifier.
jobId requiredstring
Job identifier.

Response fields

logsstring | null
Returned logs value.

POST CTFtime callback

POST /api/v1/integrations/ctftime/callback

Auth
Public
Gate
None
Permissions
No extra permissions
Captcha
No captcha
Rate limit
No rate limit

This V1 route exchanges a CTFtime OAuth code for a short lived CTFtime auth token. That token can then be used with registration, verification, login, or account linking flows.

Request body

ctftimeCode requiredstring
Request body field for ctftime code.

Response fields

ctftimeTokenstring
CTFtime authentication token.
ctftimeNamestring
Returned ctftime name value.
ctftimeIdtransform
Returned ctftime id value.

GET CTFtime leaderboard

GET /api/v1/integrations/ctftime/leaderboard

Auth
Required
Gate
None
Permissions
leaderboardRead
Captcha
No captcha
Rate limit
No rate limit

This V1 route provides the leaderboard export expected by CTFtime. It is the rare typed route that returns the body directly instead of using the rCTF response wrapper.

Response#

The response body is the raw CTFtime leaderboard.

{
"standings": [
{
"pos": 1,
"team": "otter-sec",
"score": 1200
}
]
}
FieldTypeNotes
standings{ pos: number, team: string, score: number }[]Ordered standings rows.
Esc

Start typing to search the docs.