YOU(th) API reference
Every route of the API: its scope, parameters, request body, answers, errors and samples, drawn from the API's OpenAPI description.
This page is drawn from the API's OpenAPI description, which is generated from the API's own routes, so it says what the API does. Hand that file to your own tools to generate a client or import the routes.
Get API credentials first, then get a token and send it with every request. A refused request answers a Problem document: Errors and rate limits says how to read one and when to try again.
The API partners' servers call, under /v1, with an OAuth access token their client credentials get.
- Base URL:
https://api.youth-platform.io - Token endpoint:
https://auth.youth-platform.io/realms/youth/protocol/openid-connect/token - Version:
1
Organization
The organization an integration's credentials belong to, and the integration itself.
The organization the credentials belong to, and the integration calling
/v1/organizationNeeds no particular scope, but the token must be requested with at least one granted scope, which gives it the API's audience: a partner calls it to check new credentials. The organization is the credentials', never the request's.
Any token of the API: no particular scope.
Responses
200application/jsonCurrentOrganizationThe organization and the integration.401application/problem+jsonProblemNo bearer token, or one that doesn't hold, or whose client is unknown (invalid_token), or whose integration was revoked (integration_revoked).Codes:
invalid_tokenintegration_revokedHeaders (1)
www-authenticatestringRequiredWhat the caller must present:Bearer, alone when the request carried no bearer token, and with the error it was refused for when the token didn't hold.Example:
Bearer error="invalid_token"
Body fields (1)
codestringRequiredOne of
invalid_token,integration_revokedExample:
invalid_token
500application/problem+jsonProblemThe API failed; the request id in the answer names the request (internal_error).Codes:
internal_errorBody fields (1)
codestringRequiredAlways
internal_errorExample:
internal_error
503application/problem+jsonProblemThe API can't check the token now (identity_unavailable), or gave up (timed_out): send the same request again afterRetry-Afterseconds.Codes:
identity_unavailabletimed_outHeaders (1)
retry-afterstringIn how many seconds to send the same request again.Example:
10
Body fields (1)
codestringRequiredOne of
identity_unavailable,timed_outExample:
identity_unavailable
Request
curl https://api.youth-platform.io/v1/organization \ --header "Authorization: Bearer $YOUTH_ACCESS_TOKEN"const response = await fetch("https://api.youth-platform.io/v1/organization", { headers: { Authorization: `Bearer ${process.env.YOUTH_ACCESS_TOKEN}`, },});console.log(response.status, await response.text());import osimport requestsresponse = requests.get( "https://api.youth-platform.io/v1/organization", headers={ "Authorization": f"Bearer {os.environ['YOUTH_ACCESS_TOKEN']}", },)print(response.status_code, response.text)Response
{ "organization": { "alias": "example-clinic", "name": "Example Clinic" }, "integration": { "id": "3f2b8c1e-9a47-4d65-b0e2-7c1a5d9e4f08", "name": "Billing", "scopes": [ "access_codes:read" ] }}Access codes
Batches of access codes your organization orders, and the codes in them: each gives one person access to YOU(th), and names no one.
Order a batch of access codes
/v1/access-code-batchesMakes count codes for your organization and answers 201 once every one can be read and redeemed. When that can't be finished now, it answers 503 with Retry-After: send the same order again, with the same Idempotency-Key and body, and it goes on with the same batch, never a second one. Your organization's batches ordered in one day, from 00:00 UTC, hold at most its daily limit of codes together: 1,000 unless YOU(th) raised it, on request. A repeat that goes on with a batch isn't counted again. Requires an Idempotency-Key. Needs access_codes:write.
Scope: access_codes:write
Parameters
idempotency-keyheader · stringRequiredA key of yours for the request, such as a UUID, at most 255 characters. The same key and body answer the first request again, and resume it after a503, for 24 hours after the latest attempt.Example:
5f2b6f0e-3a51-4c58-9a57-2a1f6f1d3c11
Request body
application/json AccessCodeBatchOrder
Responses
201application/jsonAccessCodeBatchThe batch,ready, at the address inLocation.Headers (1)
locationstringRequiredWhere the batch is read.Example:
/v1/access-code-batches/0193b1c0-11aa-7e02-8c55-9d3f0a7b6c21
400application/problem+jsonProblemThe body can't be parsed (malformed_request), the order has noIdempotency-Key(idempotency_key_required), or its key is empty or longer than 255 characters (idempotency_key_invalid).Codes:
malformed_requestidempotency_key_requiredidempotency_key_invalidBody fields (1)
codestringRequiredOne of
malformed_request,idempotency_key_required,idempotency_key_invalidExample:
malformed_request
401application/problem+jsonProblemNo bearer token, or one that doesn't hold, or whose client is unknown (invalid_token), or whose integration was revoked (integration_revoked).Codes:
invalid_tokenintegration_revokedHeaders (1)
www-authenticatestringRequiredWhat the caller must present:Bearer, alone when the request carried no bearer token, and with the error it was refused for when the token didn't hold.Example:
Bearer error="invalid_token"
Body fields (1)
codestringRequiredOne of
invalid_token,integration_revokedExample:
invalid_token
403application/problem+jsonProblemThe token holds none of the OAuth scopes the route needs (insufficient_scope), and the header names them; or it holds a health scope whose Doctor's grant no longer counts, and the header names none.Codes:
insufficient_scopeHeaders (1)
www-authenticatestringRequiredWhat the caller must present:Bearer, alone when the request carried no bearer token, and with the error it was refused for when the token didn't hold.Example:
Bearer error="invalid_token"
Body fields (1)
codestringRequiredAlways
insufficient_scopeExample:
insufficient_scope
409application/problem+jsonProblemThe key was used with another body (idempotency_conflict): use a new key. An order with the key runs now (idempotency_in_progress, withRetry-After): send it again then. Your organization isn't in the app yet, so no code could be redeemed (app_not_set_up): ask YOU(th).Codes:
idempotency_conflictidempotency_in_progressapp_not_set_upHeaders (1)
retry-afterstringIn how many seconds to send the same request again.Example:
10
Body fields (1)
codestringRequiredOne of
idempotency_conflict,idempotency_in_progress,app_not_set_upExample:
idempotency_conflict
415application/problem+jsonProblemThe body isn't JSON (unsupported_media_type).Codes:
unsupported_media_typeBody fields (1)
codestringRequiredAlways
unsupported_media_typeExample:
unsupported_media_type
422application/problem+jsonProblemA field is missing, not valid or not one the order takes (invalid_request),redeem_byhas passed (redeem_by_passed) or is more than five years ahead (redeem_by_too_far), or the order would take your organization past its daily limit (count_over_limit): nothing was made.Codes:
invalid_requestredeem_by_passedredeem_by_too_farcount_over_limitBody fields (1)
codestringRequiredOne of
invalid_request,redeem_by_passed,redeem_by_too_far,count_over_limitExample:
invalid_request
500application/problem+jsonProblemThe API failed; the request id in the answer names the request (internal_error).Codes:
internal_errorBody fields (1)
codestringRequiredAlways
internal_errorExample:
internal_error
503application/problem+jsonProblemThe API can't check the token now (identity_unavailable), gave up (timed_out), or can't finish the request now (temporarily_unavailable): send the same request again afterRetry-Afterseconds.Codes:
identity_unavailabletimed_outtemporarily_unavailableHeaders (1)
retry-afterstringIn how many seconds to send the same request again.Example:
10
Body fields (1)
codestringRequiredOne of
identity_unavailable,timed_out,temporarily_unavailableExample:
identity_unavailable
Request
curl --request POST https://api.youth-platform.io/v1/access-code-batches \ --header "Authorization: Bearer $YOUTH_ACCESS_TOKEN" \ --header "idempotency-key: 5f2b6f0e-3a51-4c58-9a57-2a1f6f1d3c11" \ --header "Content-Type: application/json" \ --data '{ "count": 1000, "label": "december-2026", "redeem_by": "2027-12-31T23:59:59Z", "access": { "term": "until_ended" }}'const response = await fetch("https://api.youth-platform.io/v1/access-code-batches", { method: "POST", headers: { Authorization: `Bearer ${process.env.YOUTH_ACCESS_TOKEN}`, "Content-Type": "application/json", "idempotency-key": "5f2b6f0e-3a51-4c58-9a57-2a1f6f1d3c11", }, body: JSON.stringify({ "count": 1000, "label": "december-2026", "redeem_by": "2027-12-31T23:59:59Z", "access": { "term": "until_ended" } }),});console.log(response.status, await response.text());import osimport requestsresponse = requests.post( "https://api.youth-platform.io/v1/access-code-batches", headers={ "Authorization": f"Bearer {os.environ['YOUTH_ACCESS_TOKEN']}", "idempotency-key": "5f2b6f0e-3a51-4c58-9a57-2a1f6f1d3c11", }, json={ "count": 1000, "label": "december-2026", "redeem_by": "2027-12-31T23:59:59Z", "access": { "term": "until_ended", }, },)print(response.status_code, response.text)Response
{ "id": "0193b1c0-11aa-7e02-8c55-9d3f0a7b6c21", "label": "december-2026", "status": "ready", "count": 1000, "redeem_by": "2027-12-31T23:59:59.000Z", "access": { "term": "until_ended" }, "created_at": "2026-12-01T10:00:00.000Z"}Read a batch of access codes
/v1/access-code-batches/{batch_id}One of your organization's batches. Needs access_codes:read or access_codes:write.
Scope: access_codes:read
Parameters
batch_idpath · stringRequiredThe batch's id.Format:
uuidExample:
0193b1c0-11aa-7e02-8c55-9d3f0a7b6c21
Responses
200application/jsonAccessCodeBatchThe batch.401application/problem+jsonProblemNo bearer token, or one that doesn't hold, or whose client is unknown (invalid_token), or whose integration was revoked (integration_revoked).Codes:
invalid_tokenintegration_revokedHeaders (1)
www-authenticatestringRequiredWhat the caller must present:Bearer, alone when the request carried no bearer token, and with the error it was refused for when the token didn't hold.Example:
Bearer error="invalid_token"
Body fields (1)
codestringRequiredOne of
invalid_token,integration_revokedExample:
invalid_token
403application/problem+jsonProblemThe token holds none of the OAuth scopes the route needs (insufficient_scope), and the header names them; or it holds a health scope whose Doctor's grant no longer counts, and the header names none.Codes:
insufficient_scopeHeaders (1)
www-authenticatestringRequiredWhat the caller must present:Bearer, alone when the request carried no bearer token, and with the error it was refused for when the token didn't hold.Example:
Bearer error="invalid_token"
Body fields (1)
codestringRequiredAlways
insufficient_scopeExample:
insufficient_scope
422application/problem+jsonProblemA field is missing or not valid (invalid_request).Codes:
invalid_requestBody fields (1)
codestringRequiredAlways
invalid_requestExample:
invalid_request
500application/problem+jsonProblemThe API failed; the request id in the answer names the request (internal_error).Codes:
internal_errorBody fields (1)
codestringRequiredAlways
internal_errorExample:
internal_error
503application/problem+jsonProblemThe API can't check the token now (identity_unavailable), or gave up (timed_out): send the same request again afterRetry-Afterseconds.Codes:
identity_unavailabletimed_outHeaders (1)
retry-afterstringIn how many seconds to send the same request again.Example:
10
Body fields (1)
codestringRequiredOne of
identity_unavailable,timed_outExample:
identity_unavailable
Request
curl https://api.youth-platform.io/v1/access-code-batches/0193b1c0-11aa-7e02-8c55-9d3f0a7b6c21 \ --header "Authorization: Bearer $YOUTH_ACCESS_TOKEN"const response = await fetch("https://api.youth-platform.io/v1/access-code-batches/0193b1c0-11aa-7e02-8c55-9d3f0a7b6c21", { headers: { Authorization: `Bearer ${process.env.YOUTH_ACCESS_TOKEN}`, },});console.log(response.status, await response.text());import osimport requestsresponse = requests.get( "https://api.youth-platform.io/v1/access-code-batches/0193b1c0-11aa-7e02-8c55-9d3f0a7b6c21", headers={ "Authorization": f"Bearer {os.environ['YOUTH_ACCESS_TOKEN']}", },)print(response.status_code, response.text)Response
{ "id": "0193b1c0-11aa-7e02-8c55-9d3f0a7b6c21", "label": "december-2026", "status": "ready", "count": 1000, "redeem_by": "2027-12-31T23:59:59.000Z", "access": { "term": "until_ended" }, "created_at": "2026-12-01T10:00:00.000Z"}List access codes
/v1/access-codesYour organization's codes of batches that are ready, that the filters keep, in a stable order. As JSON, a page at a time: pass a page's next as after for the next one. With Accept: text/csv, one CSV file of every code the filters keep, not paged, up to 50,000 codes. Needs access_codes:read or access_codes:write.
Scope: access_codes:read
Parameters
batch_idquery · stringThe codes of one batch.Format:
uuidExample:
0193b1c0-11aa-7e02-8c55-9d3f0a7b6c21statusquery · stringThe codes in one status.One of
available,redeemed,ended,deactivated,expiredExample:
redeemedredeemed_fromquery · stringThe codes redeemed at or after this time.Format:
date-timeExample:
2026-12-01T00:00:00Zredeemed_toquery · stringThe codes redeemed before this time.Format:
date-timeExample:
2027-01-01T00:00:00Zended_fromquery · stringThe codes whose access ended at or after this time, and has ended by now: an end still ahead isn't kept.Format:
date-timeExample:
2026-12-12T08:30:00Zafterquery · stringThe next page: thenextof the page before. Not withAccept: text/csv.Format:
uuidExample:
0193b1c2-7a4e-7c1d-9f0a-2b6d5e8f1a34limitquery · integerHow many codes a page holds, at most 1,000; 100 unless set. Not withAccept: text/csv.At least
1At most
1000Example:
100
Responses
200application/jsonAccessCodePage ortext/csvstringA page of codes, or every one as CSV.text/csv: A header line, then one line per code:id,batch_id,code,redeem_url,status,redeemed_at,access_term,access_ends_at, each empty for none.401application/problem+jsonProblemNo bearer token, or one that doesn't hold, or whose client is unknown (invalid_token), or whose integration was revoked (integration_revoked).Codes:
invalid_tokenintegration_revokedHeaders (1)
www-authenticatestringRequiredWhat the caller must present:Bearer, alone when the request carried no bearer token, and with the error it was refused for when the token didn't hold.Example:
Bearer error="invalid_token"
Body fields (1)
codestringRequiredOne of
invalid_token,integration_revokedExample:
invalid_token
403application/problem+jsonProblemThe token holds none of the OAuth scopes the route needs (insufficient_scope), and the header names them; or it holds a health scope whose Doctor's grant no longer counts, and the header names none.Codes:
insufficient_scopeHeaders (1)
www-authenticatestringRequiredWhat the caller must present:Bearer, alone when the request carried no bearer token, and with the error it was refused for when the token didn't hold.Example:
Bearer error="invalid_token"
Body fields (1)
codestringRequiredAlways
insufficient_scopeExample:
insufficient_scope
422application/problem+jsonProblemA field is missing or not valid (invalid_request), or a CSV file would hold more than 50,000 codes (too_many_codes): filter bybatch_idor a time range, or read pages as JSON.Codes:
invalid_requesttoo_many_codesBody fields (1)
codestringRequiredOne of
invalid_request,too_many_codesExample:
invalid_request
500application/problem+jsonProblemThe API failed; the request id in the answer names the request (internal_error).Codes:
internal_errorBody fields (1)
codestringRequiredAlways
internal_errorExample:
internal_error
503application/problem+jsonProblemThe API can't check the token now (identity_unavailable), or gave up (timed_out): send the same request again afterRetry-Afterseconds.Codes:
identity_unavailabletimed_outHeaders (1)
retry-afterstringIn how many seconds to send the same request again.Example:
10
Body fields (1)
codestringRequiredOne of
identity_unavailable,timed_outExample:
identity_unavailable
Request
curl https://api.youth-platform.io/v1/access-codes \ --header "Authorization: Bearer $YOUTH_ACCESS_TOKEN"const response = await fetch("https://api.youth-platform.io/v1/access-codes", { headers: { Authorization: `Bearer ${process.env.YOUTH_ACCESS_TOKEN}`, },});console.log(response.status, await response.text());import osimport requestsresponse = requests.get( "https://api.youth-platform.io/v1/access-codes", headers={ "Authorization": f"Bearer {os.environ['YOUTH_ACCESS_TOKEN']}", },)print(response.status_code, response.text)Response
{ "items": [ { "id": "0193b1c2-7a4e-7c1d-9f0a-2b6d5e8f1a34", "batch_id": "0193b1c0-11aa-7e02-8c55-9d3f0a7b6c21", "code": "482957362845", "redeem_url": "https://youthai.app.link/?~channel=partners&~feature=access_code&$partner_configuration_system_name=coopvoce&$access_code=482957362845", "status": "available", "redeemed_at": null, "access": { "term": "until_ended", "ends_at": null } } ], "next": "0193b1c2-7a4e-7c1d-9f0a-2b6d5e8f1a34"}Read an access code
/v1/access-codes/{access_code_id}One of your organization's codes, with its redeem_url: the address an event's resource_url names. Needs access_codes:read or access_codes:write.
Scope: access_codes:read
Parameters
access_code_idpath · stringRequiredThe code's id.Format:
uuidExample:
0193b1c2-7a4e-7c1d-9f0a-2b6d5e8f1a34
Responses
200application/jsonAccessCodeThe code.401application/problem+jsonProblemNo bearer token, or one that doesn't hold, or whose client is unknown (invalid_token), or whose integration was revoked (integration_revoked).Codes:
invalid_tokenintegration_revokedHeaders (1)
www-authenticatestringRequiredWhat the caller must present:Bearer, alone when the request carried no bearer token, and with the error it was refused for when the token didn't hold.Example:
Bearer error="invalid_token"
Body fields (1)
codestringRequiredOne of
invalid_token,integration_revokedExample:
invalid_token
403application/problem+jsonProblemThe token holds none of the OAuth scopes the route needs (insufficient_scope), and the header names them; or it holds a health scope whose Doctor's grant no longer counts, and the header names none.Codes:
insufficient_scopeHeaders (1)
www-authenticatestringRequiredWhat the caller must present:Bearer, alone when the request carried no bearer token, and with the error it was refused for when the token didn't hold.Example:
Bearer error="invalid_token"
Body fields (1)
codestringRequiredAlways
insufficient_scopeExample:
insufficient_scope
422application/problem+jsonProblemA field is missing or not valid (invalid_request).Codes:
invalid_requestBody fields (1)
codestringRequiredAlways
invalid_requestExample:
invalid_request
500application/problem+jsonProblemThe API failed; the request id in the answer names the request (internal_error).Codes:
internal_errorBody fields (1)
codestringRequiredAlways
internal_errorExample:
internal_error
503application/problem+jsonProblemThe API can't check the token now (identity_unavailable), or gave up (timed_out): send the same request again afterRetry-Afterseconds.Codes:
identity_unavailabletimed_outHeaders (1)
retry-afterstringIn how many seconds to send the same request again.Example:
10
Body fields (1)
codestringRequiredOne of
identity_unavailable,timed_outExample:
identity_unavailable
Request
curl https://api.youth-platform.io/v1/access-codes/0193b1c2-7a4e-7c1d-9f0a-2b6d5e8f1a34 \ --header "Authorization: Bearer $YOUTH_ACCESS_TOKEN"const response = await fetch("https://api.youth-platform.io/v1/access-codes/0193b1c2-7a4e-7c1d-9f0a-2b6d5e8f1a34", { headers: { Authorization: `Bearer ${process.env.YOUTH_ACCESS_TOKEN}`, },});console.log(response.status, await response.text());import osimport requestsresponse = requests.get( "https://api.youth-platform.io/v1/access-codes/0193b1c2-7a4e-7c1d-9f0a-2b6d5e8f1a34", headers={ "Authorization": f"Bearer {os.environ['YOUTH_ACCESS_TOKEN']}", },)print(response.status_code, response.text)Response
{ "id": "0193b1c2-7a4e-7c1d-9f0a-2b6d5e8f1a34", "batch_id": "0193b1c0-11aa-7e02-8c55-9d3f0a7b6c21", "code": "482957362845", "redeem_url": "https://youthai.app.link/?~channel=partners&~feature=access_code&$partner_configuration_system_name=coopvoce&$access_code=482957362845", "status": "available", "redeemed_at": null, "access": { "term": "until_ended", "ends_at": null }}Block an access code
/v1/access-codes/{access_code_id}/deactivateBlocks one of your organization's codes nobody redeemed, which then can never be redeemed, and answers it deactivated. Blocking it again changes nothing. A redeemed code is refused: end its access instead. Needs access_codes:write.
Scope: access_codes:write
Parameters
access_code_idpath · stringRequiredThe code's id.Format:
uuidExample:
0193b1c2-7a4e-7c1d-9f0a-2b6d5e8f1a34
Responses
200application/jsonAccessCodeThe code,deactivated.401application/problem+jsonProblemNo bearer token, or one that doesn't hold, or whose client is unknown (invalid_token), or whose integration was revoked (integration_revoked).Codes:
invalid_tokenintegration_revokedHeaders (1)
www-authenticatestringRequiredWhat the caller must present:Bearer, alone when the request carried no bearer token, and with the error it was refused for when the token didn't hold.Example:
Bearer error="invalid_token"
Body fields (1)
codestringRequiredOne of
invalid_token,integration_revokedExample:
invalid_token
403application/problem+jsonProblemThe token holds none of the OAuth scopes the route needs (insufficient_scope), and the header names them; or it holds a health scope whose Doctor's grant no longer counts, and the header names none.Codes:
insufficient_scopeHeaders (1)
www-authenticatestringRequiredWhat the caller must present:Bearer, alone when the request carried no bearer token, and with the error it was refused for when the token didn't hold.Example:
Bearer error="invalid_token"
Body fields (1)
codestringRequiredAlways
insufficient_scopeExample:
insufficient_scope
409application/problem+jsonProblemSomeone redeemed the code (already_redeemed): end its access instead. Someone is redeeming it this moment (redemption_in_progress, withRetry-After): send it again then.Codes:
already_redeemedredemption_in_progressHeaders (1)
retry-afterstringIn how many seconds to send the same request again.Example:
10
Body fields (1)
codestringRequiredOne of
already_redeemed,redemption_in_progressExample:
already_redeemed
422application/problem+jsonProblemA field is missing or not valid (invalid_request).Codes:
invalid_requestBody fields (1)
codestringRequiredAlways
invalid_requestExample:
invalid_request
500application/problem+jsonProblemThe API failed; the request id in the answer names the request (internal_error).Codes:
internal_errorBody fields (1)
codestringRequiredAlways
internal_errorExample:
internal_error
503application/problem+jsonProblemThe API can't check the token now (identity_unavailable), gave up (timed_out), or can't finish the request now (temporarily_unavailable): send the same request again afterRetry-Afterseconds.Codes:
identity_unavailabletimed_outtemporarily_unavailableHeaders (1)
retry-afterstringIn how many seconds to send the same request again.Example:
10
Body fields (1)
codestringRequiredOne of
identity_unavailable,timed_out,temporarily_unavailableExample:
identity_unavailable
Request
curl --request POST https://api.youth-platform.io/v1/access-codes/0193b1c2-7a4e-7c1d-9f0a-2b6d5e8f1a34/deactivate \ --header "Authorization: Bearer $YOUTH_ACCESS_TOKEN"const response = await fetch("https://api.youth-platform.io/v1/access-codes/0193b1c2-7a4e-7c1d-9f0a-2b6d5e8f1a34/deactivate", { method: "POST", headers: { Authorization: `Bearer ${process.env.YOUTH_ACCESS_TOKEN}`, },});console.log(response.status, await response.text());import osimport requestsresponse = requests.post( "https://api.youth-platform.io/v1/access-codes/0193b1c2-7a4e-7c1d-9f0a-2b6d5e8f1a34/deactivate", headers={ "Authorization": f"Bearer {os.environ['YOUTH_ACCESS_TOKEN']}", },)print(response.status_code, response.text)Response
{ "id": "0193b1c2-7a4e-7c1d-9f0a-2b6d5e8f1a34", "batch_id": "0193b1c0-11aa-7e02-8c55-9d3f0a7b6c21", "code": "482957362845", "redeem_url": "https://youthai.app.link/?~channel=partners&~feature=access_code&$partner_configuration_system_name=coopvoce&$access_code=482957362845", "status": "available", "redeemed_at": null, "access": { "term": "until_ended", "ends_at": null }}End the access a code started
/v1/access-codes/{access_code_id}/accessSets when the access one of your organization's redeemed codes started ends, and answers the code. A time to come ends it then; one that has passed, or none sent, ends it now; null undoes an end that hasn't passed. The access stops in the YOU(th) app within about 10 minutes after its end, later when the app can't be reached then. The same call twice leaves the same end. An end that has passed is final: ending it again answers the code as it is. Needs access_codes:write.
Scope: access_codes:write
Parameters
access_code_idpath · stringRequiredThe code's id.Format:
uuidExample:
0193b1c2-7a4e-7c1d-9f0a-2b6d5e8f1a34
Request body
application/json AccessEndChange
Responses
200application/jsonAccessCodeThe code, with the end set.401application/problem+jsonProblemNo bearer token, or one that doesn't hold, or whose client is unknown (invalid_token), or whose integration was revoked (integration_revoked).Codes:
invalid_tokenintegration_revokedHeaders (1)
www-authenticatestringRequiredWhat the caller must present:Bearer, alone when the request carried no bearer token, and with the error it was refused for when the token didn't hold.Example:
Bearer error="invalid_token"
Body fields (1)
codestringRequiredOne of
invalid_token,integration_revokedExample:
invalid_token
403application/problem+jsonProblemThe token holds none of the OAuth scopes the route needs (insufficient_scope), and the header names them; or it holds a health scope whose Doctor's grant no longer counts, and the header names none.Codes:
insufficient_scopeHeaders (1)
www-authenticatestringRequiredWhat the caller must present:Bearer, alone when the request carried no bearer token, and with the error it was refused for when the token didn't hold.Example:
Bearer error="invalid_token"
Body fields (1)
codestringRequiredAlways
insufficient_scopeExample:
insufficient_scope
409application/problem+jsonProblemNobody redeemed the code (not_redeemed): block it instead. Its access has ended, and the call asks for a later end or none (access_ended).Codes:
not_redeemedaccess_endedBody fields (1)
codestringRequiredOne of
not_redeemed,access_endedExample:
not_redeemed
415application/problem+jsonProblemThe body isn't JSON (unsupported_media_type).Codes:
unsupported_media_typeBody fields (1)
codestringRequiredAlways
unsupported_media_typeExample:
unsupported_media_type
422application/problem+jsonProblemA field is missing, not valid or not one the call takes (invalid_request), or the end is later than afixed_dayscode's own term (ends_at_beyond_term).Codes:
invalid_requestends_at_beyond_termBody fields (1)
codestringRequiredOne of
invalid_request,ends_at_beyond_termExample:
invalid_request
500application/problem+jsonProblemThe API failed; the request id in the answer names the request (internal_error).Codes:
internal_errorBody fields (1)
codestringRequiredAlways
internal_errorExample:
internal_error
503application/problem+jsonProblemThe API can't check the token now (identity_unavailable), gave up (timed_out), or can't finish the request now (temporarily_unavailable): send the same request again afterRetry-Afterseconds.Codes:
identity_unavailabletimed_outtemporarily_unavailableHeaders (1)
retry-afterstringIn how many seconds to send the same request again.Example:
10
Body fields (1)
codestringRequiredOne of
identity_unavailable,timed_out,temporarily_unavailableExample:
identity_unavailable
Request
curl --request PUT https://api.youth-platform.io/v1/access-codes/0193b1c2-7a4e-7c1d-9f0a-2b6d5e8f1a34/access \ --header "Authorization: Bearer $YOUTH_ACCESS_TOKEN" \ --header "Content-Type: application/json" \ --data '{ "ends_at": "2027-01-12T00:00:00Z"}'const response = await fetch("https://api.youth-platform.io/v1/access-codes/0193b1c2-7a4e-7c1d-9f0a-2b6d5e8f1a34/access", { method: "PUT", headers: { Authorization: `Bearer ${process.env.YOUTH_ACCESS_TOKEN}`, "Content-Type": "application/json", }, body: JSON.stringify({ "ends_at": "2027-01-12T00:00:00Z" }),});console.log(response.status, await response.text());import osimport requestsresponse = requests.put( "https://api.youth-platform.io/v1/access-codes/0193b1c2-7a4e-7c1d-9f0a-2b6d5e8f1a34/access", headers={ "Authorization": f"Bearer {os.environ['YOUTH_ACCESS_TOKEN']}", }, json={ "ends_at": "2027-01-12T00:00:00Z", },)print(response.status_code, response.text)Response
{ "id": "0193b1c2-7a4e-7c1d-9f0a-2b6d5e8f1a34", "batch_id": "0193b1c0-11aa-7e02-8c55-9d3f0a7b6c21", "code": "482957362845", "redeem_url": "https://youthai.app.link/?~channel=partners&~feature=access_code&$partner_configuration_system_name=coopvoce&$access_code=482957362845", "status": "available", "redeemed_at": null, "access": { "term": "until_ended", "ends_at": null }}Webhooks
Your organization's webhook endpoints: the HTTPS addresses YOU(th) sends signed events to, each with its own signing secret and the events it receives.
List your webhook endpoints
/v1/webhook-endpointsYour organization's endpoints, oldest first, a page at a time: pass a page's next as after for the next. An after that isn't one of your endpoints is refused with 422 invalid_request. Needs webhooks:write: there is no read-only webhook scope.
Scope: webhooks:write
Parameters
afterquery · stringThenextof the page before; none for the first page.Format:
uuidExample:
0193b1d2-6f10-7a3e-9c41-2b8e7d5f4a90limitquery · integerHow many endpoints a page holds, at most 100.At least
1At most
100Default:
50Example:
50
Responses
200application/jsonWebhookEndpointPageA page of the endpoints.401application/problem+jsonProblemNo bearer token, or one that doesn't hold, or whose client is unknown (invalid_token), or whose integration was revoked (integration_revoked).Codes:
invalid_tokenintegration_revokedHeaders (1)
www-authenticatestringRequiredWhat the caller must present:Bearer, alone when the request carried no bearer token, and with the error it was refused for when the token didn't hold.Example:
Bearer error="invalid_token"
Body fields (1)
codestringRequiredOne of
invalid_token,integration_revokedExample:
invalid_token
403application/problem+jsonProblemThe token holds none of the OAuth scopes the route needs (insufficient_scope), and the header names them; or it holds a health scope whose Doctor's grant no longer counts, and the header names none.Codes:
insufficient_scopeHeaders (1)
www-authenticatestringRequiredWhat the caller must present:Bearer, alone when the request carried no bearer token, and with the error it was refused for when the token didn't hold.Example:
Bearer error="invalid_token"
Body fields (1)
codestringRequiredAlways
insufficient_scopeExample:
insufficient_scope
422application/problem+jsonProblemA field is missing or not valid (invalid_request).Codes:
invalid_requestBody fields (1)
codestringRequiredAlways
invalid_requestExample:
invalid_request
500application/problem+jsonProblemThe API failed; the request id in the answer names the request (internal_error).Codes:
internal_errorBody fields (1)
codestringRequiredAlways
internal_errorExample:
internal_error
503application/problem+jsonProblemThe API can't check the token now (identity_unavailable), or gave up (timed_out): send the same request again afterRetry-Afterseconds.Codes:
identity_unavailabletimed_outHeaders (1)
retry-afterstringIn how many seconds to send the same request again.Example:
10
Body fields (1)
codestringRequiredOne of
identity_unavailable,timed_outExample:
identity_unavailable
Request
curl https://api.youth-platform.io/v1/webhook-endpoints \ --header "Authorization: Bearer $YOUTH_ACCESS_TOKEN"const response = await fetch("https://api.youth-platform.io/v1/webhook-endpoints", { headers: { Authorization: `Bearer ${process.env.YOUTH_ACCESS_TOKEN}`, },});console.log(response.status, await response.text());import osimport requestsresponse = requests.get( "https://api.youth-platform.io/v1/webhook-endpoints", headers={ "Authorization": f"Bearer {os.environ['YOUTH_ACCESS_TOKEN']}", },)print(response.status_code, response.text)Response
{ "items": [ { "id": "0193b1d2-6f10-7a3e-9c41-2b8e7d5f4a90", "url": "https://partner.example.com/youth-webhook", "description": "Billing", "event_types": [ "Access.ended", "AccessCode.redeemed" ], "status": "active", "created_at": "2026-11-20T09:30:00.000Z", "updated_at": "2026-11-20T09:30:00.000Z" } ], "next": null}Create a webhook endpoint
/v1/webhook-endpointsCreates an endpoint of your organization's and answers 201 with it and its signing secret, the only answer that carries the secret. Send the same create again, with the same Idempotency-Key and body, and it answers the same endpoint and secret, never a second endpoint. Requires an Idempotency-Key. Needs webhooks:write.
Scope: webhooks:write
Parameters
idempotency-keyheader · stringRequiredA key of yours for the request, such as a UUID, at most 255 characters. The same key and body answer the first request again, and resume it after a503, for 24 hours after the latest attempt.Example:
5f2b6f0e-3a51-4c58-9a57-2a1f6f1d3c11
Request body
application/json WebhookEndpointRequest
Responses
201application/jsonCreatedWebhookEndpointThe endpoint, with its signing secret, at the address inLocation.Headers (1)
locationstringRequiredWhere the endpoint is read.Example:
/v1/webhook-endpoints/0193b1d2-6f10-7a3e-9c41-2b8e7d5f4a90
400application/problem+jsonProblemThe body can't be parsed (malformed_request), the create has noIdempotency-Key(idempotency_key_required), or its key is empty or longer than 255 characters (idempotency_key_invalid).Codes:
malformed_requestidempotency_key_requiredidempotency_key_invalidBody fields (1)
codestringRequiredOne of
malformed_request,idempotency_key_required,idempotency_key_invalidExample:
malformed_request
401application/problem+jsonProblemNo bearer token, or one that doesn't hold, or whose client is unknown (invalid_token), or whose integration was revoked (integration_revoked).Codes:
invalid_tokenintegration_revokedHeaders (1)
www-authenticatestringRequiredWhat the caller must present:Bearer, alone when the request carried no bearer token, and with the error it was refused for when the token didn't hold.Example:
Bearer error="invalid_token"
Body fields (1)
codestringRequiredOne of
invalid_token,integration_revokedExample:
invalid_token
403application/problem+jsonProblemThe token holds none of the OAuth scopes the route needs (insufficient_scope), and the header names them; or it holds a health scope whose Doctor's grant no longer counts, and the header names none.Codes:
insufficient_scopeHeaders (1)
www-authenticatestringRequiredWhat the caller must present:Bearer, alone when the request carried no bearer token, and with the error it was refused for when the token didn't hold.Example:
Bearer error="invalid_token"
Body fields (1)
codestringRequiredAlways
insufficient_scopeExample:
insufficient_scope
409application/problem+jsonProblemThe key was used with another body (idempotency_conflict): use a new key. A create with the key runs now (idempotency_in_progress, withRetry-After): send it again then. Your organization keeps ten endpoints already, disabled ones aside (endpoint_limit_reached): disable one first.Codes:
idempotency_conflictidempotency_in_progressendpoint_limit_reachedHeaders (1)
retry-afterstringIn how many seconds to send the same request again.Example:
10
Body fields (1)
codestringRequiredOne of
idempotency_conflict,idempotency_in_progress,endpoint_limit_reachedExample:
idempotency_conflict
415application/problem+jsonProblemThe body isn't JSON (unsupported_media_type).Codes:
unsupported_media_typeBody fields (1)
codestringRequiredAlways
unsupported_media_typeExample:
unsupported_media_type
422application/problem+jsonProblemA field is missing, not valid or not one the create takes (invalid_request), the address isn't https on port 443 without credentials, or its host is localhost, a name of one label or an IP address that isn't public (url_not_allowed), or an event type isn't one YOU(th) sends (unknown_event_type).Codes:
invalid_requesturl_not_allowedunknown_event_typeBody fields (1)
codestringRequiredOne of
invalid_request,url_not_allowed,unknown_event_typeExample:
invalid_request
500application/problem+jsonProblemThe API failed; the request id in the answer names the request (internal_error).Codes:
internal_errorBody fields (1)
codestringRequiredAlways
internal_errorExample:
internal_error
503application/problem+jsonProblemThe API can't check the token now (identity_unavailable), gave up (timed_out), or can't finish the request now (temporarily_unavailable): send the same request again afterRetry-Afterseconds.Codes:
identity_unavailabletimed_outtemporarily_unavailableHeaders (1)
retry-afterstringIn how many seconds to send the same request again.Example:
10
Body fields (1)
codestringRequiredOne of
identity_unavailable,timed_out,temporarily_unavailableExample:
identity_unavailable
Request
curl --request POST https://api.youth-platform.io/v1/webhook-endpoints \ --header "Authorization: Bearer $YOUTH_ACCESS_TOKEN" \ --header "idempotency-key: 5f2b6f0e-3a51-4c58-9a57-2a1f6f1d3c11" \ --header "Content-Type: application/json" \ --data '{ "url": "https://partner.example.com/youth-webhook", "event_types": [ "AccessCode.redeemed", "Access.ended" ], "description": "Billing"}'const response = await fetch("https://api.youth-platform.io/v1/webhook-endpoints", { method: "POST", headers: { Authorization: `Bearer ${process.env.YOUTH_ACCESS_TOKEN}`, "Content-Type": "application/json", "idempotency-key": "5f2b6f0e-3a51-4c58-9a57-2a1f6f1d3c11", }, body: JSON.stringify({ "url": "https://partner.example.com/youth-webhook", "event_types": [ "AccessCode.redeemed", "Access.ended" ], "description": "Billing" }),});console.log(response.status, await response.text());import osimport requestsresponse = requests.post( "https://api.youth-platform.io/v1/webhook-endpoints", headers={ "Authorization": f"Bearer {os.environ['YOUTH_ACCESS_TOKEN']}", "idempotency-key": "5f2b6f0e-3a51-4c58-9a57-2a1f6f1d3c11", }, json={ "url": "https://partner.example.com/youth-webhook", "event_types": [ "AccessCode.redeemed", "Access.ended", ], "description": "Billing", },)print(response.status_code, response.text)Response
{ "id": "0193b1d2-6f10-7a3e-9c41-2b8e7d5f4a90", "url": "https://partner.example.com/youth-webhook", "description": "Billing", "event_types": [ "Access.ended", "AccessCode.redeemed" ], "status": "active", "created_at": "2026-11-20T09:30:00.000Z", "updated_at": "2026-11-20T09:30:00.000Z", "signing_secret": "whsec_Zm9vYmFyYmF6cXV4LWV4YW1wbGUtc2VjcmV0LXZhbHVl"}Read a webhook endpoint
/v1/webhook-endpoints/{webhook_endpoint_id}One of your organization's endpoints, without its signing secret. Needs webhooks:write.
Scope: webhooks:write
Parameters
webhook_endpoint_idpath · stringRequiredThe endpoint's id.Format:
uuidExample:
0193b1d2-6f10-7a3e-9c41-2b8e7d5f4a90
Responses
200application/jsonWebhookEndpointThe endpoint.401application/problem+jsonProblemNo bearer token, or one that doesn't hold, or whose client is unknown (invalid_token), or whose integration was revoked (integration_revoked).Codes:
invalid_tokenintegration_revokedHeaders (1)
www-authenticatestringRequiredWhat the caller must present:Bearer, alone when the request carried no bearer token, and with the error it was refused for when the token didn't hold.Example:
Bearer error="invalid_token"
Body fields (1)
codestringRequiredOne of
invalid_token,integration_revokedExample:
invalid_token
403application/problem+jsonProblemThe token holds none of the OAuth scopes the route needs (insufficient_scope), and the header names them; or it holds a health scope whose Doctor's grant no longer counts, and the header names none.Codes:
insufficient_scopeHeaders (1)
www-authenticatestringRequiredWhat the caller must present:Bearer, alone when the request carried no bearer token, and with the error it was refused for when the token didn't hold.Example:
Bearer error="invalid_token"
Body fields (1)
codestringRequiredAlways
insufficient_scopeExample:
insufficient_scope
422application/problem+jsonProblemA field is missing or not valid (invalid_request).Codes:
invalid_requestBody fields (1)
codestringRequiredAlways
invalid_requestExample:
invalid_request
500application/problem+jsonProblemThe API failed; the request id in the answer names the request (internal_error).Codes:
internal_errorBody fields (1)
codestringRequiredAlways
internal_errorExample:
internal_error
503application/problem+jsonProblemThe API can't check the token now (identity_unavailable), or gave up (timed_out): send the same request again afterRetry-Afterseconds.Codes:
identity_unavailabletimed_outHeaders (1)
retry-afterstringIn how many seconds to send the same request again.Example:
10
Body fields (1)
codestringRequiredOne of
identity_unavailable,timed_outExample:
identity_unavailable
Request
curl https://api.youth-platform.io/v1/webhook-endpoints/0193b1d2-6f10-7a3e-9c41-2b8e7d5f4a90 \ --header "Authorization: Bearer $YOUTH_ACCESS_TOKEN"const response = await fetch("https://api.youth-platform.io/v1/webhook-endpoints/0193b1d2-6f10-7a3e-9c41-2b8e7d5f4a90", { headers: { Authorization: `Bearer ${process.env.YOUTH_ACCESS_TOKEN}`, },});console.log(response.status, await response.text());import osimport requestsresponse = requests.get( "https://api.youth-platform.io/v1/webhook-endpoints/0193b1d2-6f10-7a3e-9c41-2b8e7d5f4a90", headers={ "Authorization": f"Bearer {os.environ['YOUTH_ACCESS_TOKEN']}", },)print(response.status_code, response.text)Response
{ "id": "0193b1d2-6f10-7a3e-9c41-2b8e7d5f4a90", "url": "https://partner.example.com/youth-webhook", "description": "Billing", "event_types": [ "Access.ended", "AccessCode.redeemed" ], "status": "active", "created_at": "2026-11-20T09:30:00.000Z", "updated_at": "2026-11-20T09:30:00.000Z"}Disable a webhook endpoint
/v1/webhook-endpoints/{webhook_endpoint_id}/disableStops deliveries to one of your organization's endpoints, active or paused: what it still had to receive fails at once, and you read it from the API. It can't be turned on again; create an endpoint for the address instead. Disabling it again answers it as it stands. Needs webhooks:write.
Scope: webhooks:write
Parameters
webhook_endpoint_idpath · stringRequiredThe endpoint's id.Format:
uuidExample:
0193b1d2-6f10-7a3e-9c41-2b8e7d5f4a90
Responses
200application/jsonWebhookEndpointThe endpoint,disabled.401application/problem+jsonProblemNo bearer token, or one that doesn't hold, or whose client is unknown (invalid_token), or whose integration was revoked (integration_revoked).Codes:
invalid_tokenintegration_revokedHeaders (1)
www-authenticatestringRequiredWhat the caller must present:Bearer, alone when the request carried no bearer token, and with the error it was refused for when the token didn't hold.Example:
Bearer error="invalid_token"
Body fields (1)
codestringRequiredOne of
invalid_token,integration_revokedExample:
invalid_token
403application/problem+jsonProblemThe token holds none of the OAuth scopes the route needs (insufficient_scope), and the header names them; or it holds a health scope whose Doctor's grant no longer counts, and the header names none.Codes:
insufficient_scopeHeaders (1)
www-authenticatestringRequiredWhat the caller must present:Bearer, alone when the request carried no bearer token, and with the error it was refused for when the token didn't hold.Example:
Bearer error="invalid_token"
Body fields (1)
codestringRequiredAlways
insufficient_scopeExample:
insufficient_scope
422application/problem+jsonProblemA field is missing or not valid (invalid_request).Codes:
invalid_requestBody fields (1)
codestringRequiredAlways
invalid_requestExample:
invalid_request
500application/problem+jsonProblemThe API failed; the request id in the answer names the request (internal_error).Codes:
internal_errorBody fields (1)
codestringRequiredAlways
internal_errorExample:
internal_error
503application/problem+jsonProblemThe API can't check the token now (identity_unavailable), or gave up (timed_out): send the same request again afterRetry-Afterseconds.Codes:
identity_unavailabletimed_outHeaders (1)
retry-afterstringIn how many seconds to send the same request again.Example:
10
Body fields (1)
codestringRequiredOne of
identity_unavailable,timed_outExample:
identity_unavailable
Request
curl --request POST https://api.youth-platform.io/v1/webhook-endpoints/0193b1d2-6f10-7a3e-9c41-2b8e7d5f4a90/disable \ --header "Authorization: Bearer $YOUTH_ACCESS_TOKEN"const response = await fetch("https://api.youth-platform.io/v1/webhook-endpoints/0193b1d2-6f10-7a3e-9c41-2b8e7d5f4a90/disable", { method: "POST", headers: { Authorization: `Bearer ${process.env.YOUTH_ACCESS_TOKEN}`, },});console.log(response.status, await response.text());import osimport requestsresponse = requests.post( "https://api.youth-platform.io/v1/webhook-endpoints/0193b1d2-6f10-7a3e-9c41-2b8e7d5f4a90/disable", headers={ "Authorization": f"Bearer {os.environ['YOUTH_ACCESS_TOKEN']}", },)print(response.status_code, response.text)Response
{ "id": "0193b1d2-6f10-7a3e-9c41-2b8e7d5f4a90", "url": "https://partner.example.com/youth-webhook", "description": "Billing", "event_types": [ "Access.ended", "AccessCode.redeemed" ], "status": "active", "created_at": "2026-11-20T09:30:00.000Z", "updated_at": "2026-11-20T09:30:00.000Z"}Schemas
AccessCodeRedeemed
event_idstringRequiredMatches
^evt_[0-9a-f]{32}$Example:
evt_3b9f2c1a7d4e4f6a8c5b0e1d2f3a4b5cevent_typestringRequiredAlways
AccessCode.redeemedExample:
AccessCode.redeemedoccurred_atstringRequiredFormat:
date-timeExample:
2026-12-12T09:30:00.375000Zresource_urlstringRequiredFormat:
uriExample:
https://api.youth-platform.io/v1/access-codes/0193b1c2-7a4e-7c1d-9f0a-2b6d5e8f1a34access_code_idstringRequiredFormat:
uuidExample:
0193b1c2-7a4e-7c1d-9f0a-2b6d5e8f1a34batch_idstringRequiredFormat:
uuidExample:
0193b1c0-11aa-7e02-8c55-9d3f0a7b6c21
AccessEnded
event_idstringRequiredMatches
^evt_[0-9a-f]{32}$Example:
evt_3b9f2c1a7d4e4f6a8c5b0e1d2f3a4b5cevent_typestringRequiredAlways
Access.endedExample:
Access.endedoccurred_atstringRequiredFormat:
date-timeExample:
2026-12-12T09:30:00.375000Zresource_urlstringRequiredFormat:
uriExample:
https://api.youth-platform.io/v1/access-codes/0193b1c2-7a4e-7c1d-9f0a-2b6d5e8f1a34access_code_idstringRequiredFormat:
uuidExample:
0193b1c2-7a4e-7c1d-9f0a-2b6d5e8f1a34batch_idstringRequiredFormat:
uuidExample:
0193b1c0-11aa-7e02-8c55-9d3f0a7b6c21reasonstringRequiredOne of
ended_by_partner,term_overExample:
ended_by_partner
CurrentOrganization
The organization the credentials belong to, and the integration calling: what a partner reads to check new credentials.
organizationobjectRequiredThe organization the credentials belong to.Child fields (2)
organization.aliasstringRequiredThe organization's alias, which never changes.1 to 255 characters
Example:
example-clinicorganization.namestringRequiredThe organization's name.Example:
Example Clinic
integrationobjectRequiredThe integration calling.Child fields (3)
integration.idstringRequiredThe integration's id.Example:
3f2b8c1e-9a47-4d65-b0e2-7c1a5d9e4f08integration.namestringRequiredThe name its admins gave it.Example:
Billingintegration.scopesarray of stringRequiredThe OAuth scopes the calling token holds, in the catalogue's order. Today: access_codes:read, access_codes:write, webhooks:write, checkups:read, patients:read. A scope added later appears here without a new version, so read each as text.Example:
["access_codes:read"]
Problem
typestringRequiredAlwaysabout:blank: the status andcodesay what happened.Always
about:blankExample:
about:blanktitlestringRequiredThe status's English name, for logs; match oncodeinstead.Example:
UnauthorizedstatusintegerRequiredThe HTTP status of the answer.Example:
401codestringRequiredWhat happened, stable and in snake_case; clients translate it. Codes can be added within v1, so a client treats a code it doesn't know by the HTTP status.Matches
^[a-z][a-z0-9_]*$Example:
invalid_tokenrequest_idstringRequiredThe request's id, as the logs name it.Example:
7f3c2a9e-5b1d-4c6a-9e0f-2d8b4a1c6e53
AccessCodeBatch
idstringRequiredThe batch's id: what its codes and the other routes name.Format:
uuidExample:
0193b1c0-11aa-7e02-8c55-9d3f0a7b6c21labelstringRequiredThe name of yours the order gave it.Example:
december-2026statusstringRequiredreadyonce every code can be read and redeemed, which an order answers with.creatingwhile an order that answered503hasn't been sent again;failedwhen none was within a day, and then none of its codes is listed or billed.One of
creating,ready,failedExample:
readycountintegerRequiredHow many codes it holds.Example:
1000redeem_bystring or nullRequiredThe last moment one of its codes can be redeemed; none for no end.Format:
date-timeExample:
2027-12-31T23:59:59.000Z- What a redeemed code grants.
Example:
{"term":"until_ended"} created_atstringRequiredWhen it was ordered.Format:
date-timeExample:
2026-12-01T10:00:00.000Z
FixedDaysAccess
termstringRequiredAccess fordaysdays from the redemption, which then ends by itself.Always
fixed_daysExample:
fixed_daysdaysintegerRequiredHow many days a redeemed code's access lasts.At least
1At most
3650Example:
30
UntilEndedAccess
termstringRequiredAccess until the organization ends it, for a service billed by period.Always
until_endedExample:
until_ended
AccessCodeBatchOrder
countintegerRequiredHow many codes, at most 20,000, and within your organization's daily limit: 1,000 codes a day unless YOU(th) raised it.At least
1At most
20000Example:
1000labelstringRequiredA name of yours for the batch, such as the month or your order number. It is never shown to a customer.1 to 100 characters
Example:
december-2026redeem_bystring or nullThe last moment a code of the batch can be redeemed, still to come and at most five years ahead; none for no end.Format:
date-timeExample:
2027-12-31T23:59:59Z- What a redeemed code of the batch grants.
Example:
{"term":"until_ended"}
FixedDaysAccessOrder
termstringRequiredAccess fordaysdays from the redemption, which then ends by itself.Always
fixed_daysExample:
fixed_daysdaysintegerRequiredHow many days a redeemed code's access lasts.At least
1At most
3650Example:
30
UntilEndedAccessOrder
termstringRequiredAccess until the organization ends it, for a service billed by period.Always
until_endedExample:
until_ended
AccessCodePage
- The page's codes, in order of their ids.
Example:
[{"id":"0193b1c2-7a4e-7c1d-9f0a-2b6d5e8f1a34","batch_id":"0193b1c0-11aa-7e02-8c55-9d3f0a7b6c21","code":"482957362845","redeem_url":"https://youthai.app.link/?~channel=partners&~feature=access_code&$partner_configuration_system_name=coopvoce&$access_code=482957362845","status":"available","redeemed_at":null,"access":{"term":"until_ended","ends_at":null}}] nextstring or nullRequiredPass it asafterto read the next page; none on the last.Format:
uuidExample:
0193b1c2-7a4e-7c1d-9f0a-2b6d5e8f1a34
AccessCode
idstringRequiredThe code's id: what events and the other routes name. Store it beside the code.Format:
uuidExample:
0193b1c2-7a4e-7c1d-9f0a-2b6d5e8f1a34batch_idstringRequiredIts batch's id.Format:
uuidExample:
0193b1c0-11aa-7e02-8c55-9d3f0a7b6c21codestringRequiredWhat the customer types. An opaque string: store and show it exactly as it is, without spaces. A secret until redeemed.Example:
482957362845redeem_urlstring or nullRequiredThe link that redeems it in the YOU(th) app, with your organization and the code filled in: use it exactly as it is. Absent (null) when your organization's members redeem in an app of its own.Format:
uriExample:
https://youthai.app.link/?~channel=partners&~feature=access_code&$partner_configuration_system_name=coopvoce&$access_code=482957362845statusstringRequiredavailableuntil someone redeems it, thenredeemed, thenendedonce its access has stopped; ordeactivatedonce you block it, orexpiredpast its batch'sredeem_by.One of
available,redeemed,ended,deactivated,expiredExample:
availableredeemed_atstring or nullRequiredWhen it was redeemed; none until it is.Format:
date-timeExample:
nullaccessobjectRequiredThe access it grants, once redeemed.Child fields (2)
access.termstringRequiredIts batch's term.One of
fixed_days,until_endedExample:
until_endedaccess.ends_atstring or nullRequiredWhen its access ends or ended: the end you set, or afixed_dayscode's last day once redeemed; none while no end is set.Format:
date-timeExample:
null
AccessEndChange
ends_atstring or nullWhen the access ends. A time to come ends it then; one that has passed, or none sent, ends it now;nullundoes an end that hasn't passed, back to the code's own term.Format:
date-timeExample:
2027-01-12T00:00:00Z
CreatedWebhookEndpoint
Type: WebhookEndpoint
signing_secretstringRequiredWhat your receiver verifies each delivery with:whsec_and its key. Only the create answers it, and a repeat of the create with the sameIdempotency-Keywithin 24 hours; store it in your secret store at once.Example:
whsec_Zm9vYmFyYmF6cXV4LWV4YW1wbGUtc2VjcmV0LXZhbHVl
WebhookEndpoint
idstringRequiredThe endpoint's id.Format:
uuidExample:
0193b1d2-6f10-7a3e-9c41-2b8e7d5f4a90urlstringRequiredWhere its deliveries go.Example:
https://partner.example.com/youth-webhookdescriptionstring or nullRequiredYour note about it; none if you gave none.Example:
Billingevent_typesarray of stringRequiredThe events it receives, in alphabetical order.Example:
["Access.ended","AccessCode.redeemed"]statusstringRequiredactive: deliveries are sent.paused: YOU(th) stopped sending, because the address kept answering404or410.disabled: you stopped it.One of
active,paused,disabledExample:
activecreated_atstringRequiredWhen it was created, in UTC.Format:
date-timeExample:
2026-11-20T09:30:00.000Zupdated_atstringRequiredWhen it last changed, in UTC.Format:
date-timeExample:
2026-11-20T09:30:00.000Z
WebhookEndpointRequest
urlstringRequiredWhere deliveries go: anhttpsaddress on port 443, without credentials, whose host resolves to public addresses when each delivery is sent.At most 2048 characters
Example:
https://partner.example.com/youth-webhookevent_typesarray of stringRequiredThe events it receives, byevent_type; each named once is enough.1 to 20 items
Each item: 1 to 100 characters
Example:
["AccessCode.redeemed","Access.ended"]descriptionstringA note of yours about it, such as the system it feeds.1 to 200 characters
Example:
Billing
WebhookEndpointPage
- The page's endpoints, oldest first.
Example:
[{"id":"0193b1d2-6f10-7a3e-9c41-2b8e7d5f4a90","url":"https://partner.example.com/youth-webhook","description":"Billing","event_types":["Access.ended","AccessCode.redeemed"],"status":"active","created_at":"2026-11-20T09:30:00.000Z","updated_at":"2026-11-20T09:30:00.000Z"}] nextstring or nullRequiredPass asafterfor the next page; none after the last.Format:
uuidExample:
null
Errors
invalid_token401No bearer token, or one that doesn't hold, or whose client is unknown (invalid_token), or whose integration was revoked (integration_revoked).Answered by
GET /v1/organizationPOST /v1/access-code-batchesGET /v1/access-code-batches/{batch_id}GET /v1/access-codesGET /v1/access-codes/{access_code_id}POST /v1/access-codes/{access_code_id}/deactivatePUT /v1/access-codes/{access_code_id}/accessGET /v1/webhook-endpointsPOST /v1/webhook-endpointsGET /v1/webhook-endpoints/{webhook_endpoint_id}POST /v1/webhook-endpoints/{webhook_endpoint_id}/disableintegration_revoked401No bearer token, or one that doesn't hold, or whose client is unknown (invalid_token), or whose integration was revoked (integration_revoked).Answered by
GET /v1/organizationPOST /v1/access-code-batchesGET /v1/access-code-batches/{batch_id}GET /v1/access-codesGET /v1/access-codes/{access_code_id}POST /v1/access-codes/{access_code_id}/deactivatePUT /v1/access-codes/{access_code_id}/accessGET /v1/webhook-endpointsPOST /v1/webhook-endpointsGET /v1/webhook-endpoints/{webhook_endpoint_id}POST /v1/webhook-endpoints/{webhook_endpoint_id}/disableinternal_error500The API failed; the request id in the answer names the request (internal_error).Answered by
GET /v1/organizationPOST /v1/access-code-batchesGET /v1/access-code-batches/{batch_id}GET /v1/access-codesGET /v1/access-codes/{access_code_id}POST /v1/access-codes/{access_code_id}/deactivatePUT /v1/access-codes/{access_code_id}/accessGET /v1/webhook-endpointsPOST /v1/webhook-endpointsGET /v1/webhook-endpoints/{webhook_endpoint_id}POST /v1/webhook-endpoints/{webhook_endpoint_id}/disabletimed_out503The API can't check the token now (identity_unavailable), or gave up (timed_out): send the same request again afterRetry-Afterseconds. The API can't check the token now (identity_unavailable), gave up (timed_out), or can't finish the request now (temporarily_unavailable): send the same request again afterRetry-Afterseconds.Answered by
GET /v1/organizationPOST /v1/access-code-batchesGET /v1/access-code-batches/{batch_id}GET /v1/access-codesGET /v1/access-codes/{access_code_id}POST /v1/access-codes/{access_code_id}/deactivatePUT /v1/access-codes/{access_code_id}/accessGET /v1/webhook-endpointsPOST /v1/webhook-endpointsGET /v1/webhook-endpoints/{webhook_endpoint_id}POST /v1/webhook-endpoints/{webhook_endpoint_id}/disablemalformed_request400The body can't be parsed (malformed_request), the order has noIdempotency-Key(idempotency_key_required), or its key is empty or longer than 255 characters (idempotency_key_invalid). The body can't be parsed (malformed_request), the create has noIdempotency-Key(idempotency_key_required), or its key is empty or longer than 255 characters (idempotency_key_invalid).Answered by
POST /v1/access-code-batchesPOST /v1/webhook-endpointsidempotency_key_required400The body can't be parsed (malformed_request), the order has noIdempotency-Key(idempotency_key_required), or its key is empty or longer than 255 characters (idempotency_key_invalid). The body can't be parsed (malformed_request), the create has noIdempotency-Key(idempotency_key_required), or its key is empty or longer than 255 characters (idempotency_key_invalid).Answered by
POST /v1/access-code-batchesPOST /v1/webhook-endpointsidempotency_key_invalid400The body can't be parsed (malformed_request), the order has noIdempotency-Key(idempotency_key_required), or its key is empty or longer than 255 characters (idempotency_key_invalid). The body can't be parsed (malformed_request), the create has noIdempotency-Key(idempotency_key_required), or its key is empty or longer than 255 characters (idempotency_key_invalid).Answered by
POST /v1/access-code-batchesPOST /v1/webhook-endpointsinsufficient_scope403The token holds none of the OAuth scopes the route needs (insufficient_scope), and the header names them; or it holds a health scope whose Doctor's grant no longer counts, and the header names none.Answered by
POST /v1/access-code-batchesGET /v1/access-code-batches/{batch_id}GET /v1/access-codesGET /v1/access-codes/{access_code_id}POST /v1/access-codes/{access_code_id}/deactivatePUT /v1/access-codes/{access_code_id}/accessGET /v1/webhook-endpointsPOST /v1/webhook-endpointsGET /v1/webhook-endpoints/{webhook_endpoint_id}POST /v1/webhook-endpoints/{webhook_endpoint_id}/disableidempotency_conflict409The key was used with another body (idempotency_conflict): use a new key. An order with the key runs now (idempotency_in_progress, withRetry-After): send it again then. Your organization isn't in the app yet, so no code could be redeemed (app_not_set_up): ask YOU(th). The key was used with another body (idempotency_conflict): use a new key. A create with the key runs now (idempotency_in_progress, withRetry-After): send it again then. Your organization keeps ten endpoints already, disabled ones aside (endpoint_limit_reached): disable one first.Answered by
POST /v1/access-code-batchesPOST /v1/webhook-endpointsidempotency_in_progress409The key was used with another body (idempotency_conflict): use a new key. An order with the key runs now (idempotency_in_progress, withRetry-After): send it again then. Your organization isn't in the app yet, so no code could be redeemed (app_not_set_up): ask YOU(th). The key was used with another body (idempotency_conflict): use a new key. A create with the key runs now (idempotency_in_progress, withRetry-After): send it again then. Your organization keeps ten endpoints already, disabled ones aside (endpoint_limit_reached): disable one first.Answered by
POST /v1/access-code-batchesPOST /v1/webhook-endpointsapp_not_set_up409The key was used with another body (idempotency_conflict): use a new key. An order with the key runs now (idempotency_in_progress, withRetry-After): send it again then. Your organization isn't in the app yet, so no code could be redeemed (app_not_set_up): ask YOU(th).Answered by
POST /v1/access-code-batchestoo_large413The body is over the API's limit (too_large).Answered by
POST /v1/access-code-batchesPUT /v1/access-codes/{access_code_id}/accessPOST /v1/webhook-endpointsunsupported_media_type415The body isn't JSON (unsupported_media_type).Answered by
POST /v1/access-code-batchesPUT /v1/access-codes/{access_code_id}/accessPOST /v1/webhook-endpointsinvalid_request422A field is missing, not valid or not one the order takes (invalid_request),redeem_byhas passed (redeem_by_passed) or is more than five years ahead (redeem_by_too_far), or the order would take your organization past its daily limit (count_over_limit): nothing was made. A field is missing or not valid (invalid_request). A field is missing or not valid (invalid_request), or a CSV file would hold more than 50,000 codes (too_many_codes): filter bybatch_idor a time range, or read pages as JSON. A field is missing, not valid or not one the call takes (invalid_request), or the end is later than afixed_dayscode's own term (ends_at_beyond_term). A field is missing, not valid or not one the create takes (invalid_request), the address isn't https on port 443 without credentials, or its host is localhost, a name of one label or an IP address that isn't public (url_not_allowed), or an event type isn't one YOU(th) sends (unknown_event_type).Answered by
POST /v1/access-code-batchesGET /v1/access-code-batches/{batch_id}GET /v1/access-codesGET /v1/access-codes/{access_code_id}POST /v1/access-codes/{access_code_id}/deactivatePUT /v1/access-codes/{access_code_id}/accessGET /v1/webhook-endpointsPOST /v1/webhook-endpointsGET /v1/webhook-endpoints/{webhook_endpoint_id}POST /v1/webhook-endpoints/{webhook_endpoint_id}/disableredeem_by_passed422A field is missing, not valid or not one the order takes (invalid_request),redeem_byhas passed (redeem_by_passed) or is more than five years ahead (redeem_by_too_far), or the order would take your organization past its daily limit (count_over_limit): nothing was made.Answered by
POST /v1/access-code-batchesredeem_by_too_far422A field is missing, not valid or not one the order takes (invalid_request),redeem_byhas passed (redeem_by_passed) or is more than five years ahead (redeem_by_too_far), or the order would take your organization past its daily limit (count_over_limit): nothing was made.Answered by
POST /v1/access-code-batchescount_over_limit422A field is missing, not valid or not one the order takes (invalid_request),redeem_byhas passed (redeem_by_passed) or is more than five years ahead (redeem_by_too_far), or the order would take your organization past its daily limit (count_over_limit): nothing was made.Answered by
POST /v1/access-code-batchesnot_found404No batch of yours has this id (not_found). No code of yours has this id (not_found). No endpoint of yours has this id (not_found).Answered by
GET /v1/access-code-batches/{batch_id}GET /v1/access-codes/{access_code_id}POST /v1/access-codes/{access_code_id}/deactivatePUT /v1/access-codes/{access_code_id}/accessGET /v1/webhook-endpoints/{webhook_endpoint_id}POST /v1/webhook-endpoints/{webhook_endpoint_id}/disabletoo_many_codes422A field is missing or not valid (invalid_request), or a CSV file would hold more than 50,000 codes (too_many_codes): filter bybatch_idor a time range, or read pages as JSON.Answered by
GET /v1/access-codesalready_redeemed409Someone redeemed the code (already_redeemed): end its access instead. Someone is redeeming it this moment (redemption_in_progress, withRetry-After): send it again then.Answered by
POST /v1/access-codes/{access_code_id}/deactivateredemption_in_progress409Someone redeemed the code (already_redeemed): end its access instead. Someone is redeeming it this moment (redemption_in_progress, withRetry-After): send it again then.Answered by
POST /v1/access-codes/{access_code_id}/deactivatenot_redeemed409Nobody redeemed the code (not_redeemed): block it instead. Its access has ended, and the call asks for a later end or none (access_ended).Answered by
PUT /v1/access-codes/{access_code_id}/accessaccess_ended409Nobody redeemed the code (not_redeemed): block it instead. Its access has ended, and the call asks for a later end or none (access_ended).Answered by
PUT /v1/access-codes/{access_code_id}/accessends_at_beyond_term422A field is missing, not valid or not one the call takes (invalid_request), or the end is later than afixed_dayscode's own term (ends_at_beyond_term).Answered by
PUT /v1/access-codes/{access_code_id}/accessendpoint_limit_reached409The key was used with another body (idempotency_conflict): use a new key. A create with the key runs now (idempotency_in_progress, withRetry-After): send it again then. Your organization keeps ten endpoints already, disabled ones aside (endpoint_limit_reached): disable one first.Answered by
POST /v1/webhook-endpointsurl_not_allowed422A field is missing, not valid or not one the create takes (invalid_request), the address isn't https on port 443 without credentials, or its host is localhost, a name of one label or an IP address that isn't public (url_not_allowed), or an event type isn't one YOU(th) sends (unknown_event_type).Answered by
POST /v1/webhook-endpointsunknown_event_type422A field is missing, not valid or not one the create takes (invalid_request), the address isn't https on port 443 without credentials, or its host is localhost, a name of one label or an IP address that isn't public (url_not_allowed), or an event type isn't one YOU(th) sends (unknown_event_type).Answered by
POST /v1/webhook-endpoints
Scopes
access_codes:readRead batches and codesNeeded by
GET /v1/access-code-batches/{batch_id}GET /v1/access-codesGET /v1/access-codes/{access_code_id}access_codes:writeOrder batches, block a code, end an accessNeeded by
POST /v1/access-code-batchesPOST /v1/access-codes/{access_code_id}/deactivatePUT /v1/access-codes/{access_code_id}/accesswebhooks:writeCreate, read and disable webhook endpointsNeeded by
GET /v1/webhook-endpointsPOST /v1/webhook-endpointsGET /v1/webhook-endpoints/{webhook_endpoint_id}POST /v1/webhook-endpoints/{webhook_endpoint_id}/disablecheckups:readRead checkupspatients:readRead members
Events
AccessCode.redeemed
AccessCode.redeemed
A code of your organization's was redeemed. occurred_at is the redemption: the time to bill from.
Payload
application/json AccessCodeRedeemed
{ "event_id": "evt_3b9f2c1a7d4e4f6a8c5b0e1d2f3a4b5c", "event_type": "AccessCode.redeemed", "occurred_at": "2026-12-12T09:30:00.375000Z", "resource_url": "https://api.youth-platform.io/v1/access-codes/0193b1c2-7a4e-7c1d-9f0a-2b6d5e8f1a34", "access_code_id": "0193b1c2-7a4e-7c1d-9f0a-2b6d5e8f1a34", "batch_id": "0193b1c0-11aa-7e02-8c55-9d3f0a7b6c21"}Access.ended
Access.ended
The access a code started ended: the end you set passed (ended_by_partner), or a fixed_days code reached its last day (term_over). occurred_at is when it ended. New reasons can appear.
Payload
application/json AccessEnded
{ "event_id": "evt_3b9f2c1a7d4e4f6a8c5b0e1d2f3a4b5c", "event_type": "Access.ended", "occurred_at": "2026-12-12T09:30:00.375000Z", "resource_url": "https://api.youth-platform.io/v1/access-codes/0193b1c2-7a4e-7c1d-9f0a-2b6d5e8f1a34", "access_code_id": "0193b1c2-7a4e-7c1d-9f0a-2b6d5e8f1a34", "batch_id": "0193b1c0-11aa-7e02-8c55-9d3f0a7b6c21", "reason": "ended_by_partner"}