### GET /v1/oauth2/resources Source: https://docs.ageverif.com/oauth2.html Retrieves the verified user resources using a valid access token. ```APIDOC ## GET /v1/oauth2/resources ### Description Optional endpoint to fetch verified visitor resources using the access token. ### Method GET ### Endpoint https://api.ageverif.com/v1/oauth2/resources ### Parameters #### Headers - **Authorization** (string) - Required - 'Bearer [access_token]' ### Response #### Success Response (200) - **verified** (boolean) - Indicates if the user has successfully verified their age. ``` -------------------------------- ### AgeVerif API: start() Method Source: https://docs.ageverif.com/checker.html The asynchronous 'start' method initiates the AgeVerif Checker. It accepts optional parameters for forcing verification, setting language, and controlling modal behavior. This method is intended for advanced integrations where the checker is not automatically started. ```typescript async start({ forceVerification?: boolean; language?: Language; closable?: boolean; hidden?: boolean; target?: 'popup' | 'tab'; }): Promise<{ verified: boolean, verification: Verification | null, }> ``` -------------------------------- ### Manually Starting AgeVerif Checker (JavaScript) Source: https://docs.ageverif.com/checker.html Demonstrates how to manually start the AgeVerif Checker using its JavaScript API. This is used in conjunction with the 'nostart' parameter during script integration. ```javascript ageverif.start(); ``` -------------------------------- ### GET /v1/oauth2/resources Source: https://docs.ageverif.com/oauth2.html Retrieves the verification status and details of a visitor using a valid access token. ```APIDOC ## GET /v1/oauth2/resources ### Description Retrieves visitor verification resources using an access token. If the response is successful, the visitor is verified. ### Method GET ### Endpoint https://api.ageverif.com/v1/oauth2/resources ### Parameters #### Headers - **Authorization** (string) - Required - Format: 'Bearer [access_token]'. ### Response #### Success Response (200) - **resources** (object) - Contains verification details including verified status, uid, country, and assurance level. #### Response Example { "resources": { "verified": true, "uid": "F1Hkgz2lvaUdF8Ia8WNBL", "country": "US", "country_subdivision": "US-CA", "assurance_level": "STRICT", "age_threshold": 18, "expires_at": 781045200, "expires_in": 3600 } } ``` -------------------------------- ### Example Error Response Source: https://docs.ageverif.com/external-api.html An example JSON object representing an API error response, indicating an unauthorized request. ```json { "message": "Invalid token", "error": "Unauthorized", "statusCode": 401 } ``` -------------------------------- ### GET /external/website/{website_id}/key/{environment} Source: https://docs.ageverif.com/external-api.html Retrieve the public key for a registered website. ```APIDOC ## GET /external/website/{website_id}/key/{environment} ### Description Retrieve the public key for a registered website. ### Method GET ### Endpoint https://webmasters-api.ageverif.com/external/website/{website_id}/key/{environment} ### Parameters #### Path Parameters - **website_id** (string) - Required - The unique identifier of the website. - **environment** (string) - Required - The environment for the key pair (LIVE or TEST). ### Response #### Success Response (200) - **environment** (string) - The environment for the key pair. - **publicKey** (string) - The public key for the website. #### Response Example { "environment": "LIVE", "publicKey": "-----BEGIN PUBLIC KEY-----"..." } ``` -------------------------------- ### GET /external/website/{website_id}/oauth2/{environment} Source: https://docs.ageverif.com/external-api.html Retrieve a specific OAuth2 configuration for a registered website. ```APIDOC ## GET /external/website/{website_id}/oauth2/{environment} ### Description Retrieve a specific OAuth2 configuration for a registered website. ### Method GET ### Endpoint https://webmasters-api.ageverif.com/external/website/{website_id}/oauth2/{environment} ### Response #### Success Response (200) - **environment** (string) - The environment. - **redirectUris** (array) - List of allowed redirect URIs. - **status** (string) - Current status. - **clientId** (string) - Unique identifier (only if ACTIVE). - **clientSecret** (string) - Secret key (only if ACTIVE). #### Response Example { "environment": "LIVE", "redirectUris": ["https://example.com/callback"], "status": "ACTIVE", "clientId": "client_123", "clientSecret": "secret_456" } ``` -------------------------------- ### GET /v1/oauth2/checker Source: https://docs.ageverif.com/oauth2.html Initiates the OAuth2 authorization flow by redirecting the user to the AgeVerif authorization page. ```APIDOC ## GET /v1/oauth2/checker ### Description Initiates the authorization process. The website opens a new window to this endpoint to allow the visitor to accept or deny the authorization request. ### Method GET ### Endpoint https://api.ageverif.com/v1/oauth2/checker ### Parameters #### Query Parameters - **client_id** (string) - Required - Your website's OAuth2 Live Client ID. - **redirect_uri** (string) - Required - Callback URI where the visitor is redirected after authorization. - **response_type** (string) - Required - Must be 'code'. - **scope** (string) - Optional - Permission scope (default: 'read'). - **state** (string) - Optional - String to verify state and prevent CSRF. - **language** (string) - Optional - Language code (e.g., 'en', 'fr'). - **challenges** (string) - Optional - Comma-separated list of challenges to load. ### Request Example GET https://api.ageverif.com/v1/oauth2/checker?client_id=V61LHMuuwahgYDcGnagso&redirect_uri=https%3A%2F%2Fwww.example.org%2Foauth2-callback&response_type=code&scope=read&state=abc123 ### Response #### Success Response (302 Redirect) - **code** (string) - Authorization code valid for 10 minutes. - **state** (string) - The state parameter provided in the initial request. ``` -------------------------------- ### GET /v1/oauth2/checker Source: https://docs.ageverif.com/oauth2.html Initiates the OAuth2 authorization flow by redirecting the user to the AgeVerif verification page. ```APIDOC ## GET /v1/oauth2/checker ### Description Redirects the visitor to the AgeVerif authorization endpoint to start the age verification process. ### Method GET ### Endpoint https://api.ageverif.com/v1/oauth2/checker ### Parameters #### Query Parameters - **response_type** (string) - Required - Must be 'code'. - **client_id** (string) - Required - Your unique Client ID. - **redirect_uri** (string) - Required - The URL to redirect to after authorization. - **scope** (string) - Required - The scope of access, typically 'read'. - **state** (string) - Required - A unique string to prevent CSRF attacks. ### Response Redirects the user to the provided `redirect_uri` with `code` and `state` parameters. ``` -------------------------------- ### GET /external/website/{website_id} Source: https://docs.ageverif.com/external-api.html Retrieve the full configuration details for a specific registered website. ```APIDOC ## GET /external/website/{website_id} ### Description Retrieve details of a registered website including keys and current settings. ### Method GET ### Endpoint https://webmasters-api.ageverif.com/external/website/{website_id} ### Parameters #### Path Parameters - **website_id** (string) - Required - The unique identifier of the website. ### Response #### Success Response (200) - **id** (number) - Unique website id. - **name** (string) - Website name. - **domain** (string) - Website domain. - **language** (string) - Language set for the website. - **regions** (array) - Regions set for the website. - **challenges** (array) - Challenges set for the website. - **keys** (array) - Public keys for the website in different environments. ### Response Example { "id": 123, "name": "Example", "domain": "example.com", "language": "en", "regions": [], "challenges": ["selfie"], "keys": [{"environment": "LIVE", "publicKey": "..."}] } ``` -------------------------------- ### Retrieve Visitor Resources Source: https://docs.ageverif.com/oauth2.html Uses the obtained access token to fetch verified visitor resources from the AgeVerif API. This step is optional as the token exchange confirms verification. ```bash curl -X GET https://api.ageverif.com/v1/oauth2/resources \ -H "Authorization Bearer [access_token]" ``` -------------------------------- ### GET /checker.js Source: https://docs.ageverif.com/checker.html Loads the AgeVerif checker script with custom configuration via query parameters. ```APIDOC ## GET /checker.js ### Description Loads the AgeVerif verification script. This script can be customized using query parameters to control behavior, language, and event callbacks. ### Method GET ### Endpoint https://www.ageverif.com/checker.js ### Parameters #### Query Parameters - **key** (string) - Required - Your website's unique Key from the Webmasters Platform. - **nostart** (flag) - Optional - Prevents the Checker from starting automatically. Use `ageverif.start()` to trigger. - **language** (string) - Optional - Forces language (auto, de, en, es, fr, it, pt). Default: `auto`. - **challenges** (string) - Optional - Comma-separated list of challenges (selfie, email_age, credit_card, ticket, anonymage, pleenk). - **onload** (string) - Optional - Global function name to call when script is loaded. - **onready** (string) - Optional - Global function name to call when Checker is visible and ready. - **onsuccess** (string) - Optional - Global function name to call upon successful verification. - **onclose** (string) - Optional - Global function name to call when the modal is closed. - **onerror** (string) - Optional - Global function name to call when a fatal error occurs. ### Request Example ### Response #### Success Response (200) - **Content-Type** (text/javascript) - The AgeVerif client-side library. ``` -------------------------------- ### Content Security Policy (CSP) for AgeVerif Source: https://docs.ageverif.com/checker.html This example shows how to configure Content Security Policy (CSP) headers to allow the AgeVerif checker script and its associated resources to load correctly. It specifies allowed sources for scripts, images, and connections. ```http Content-Security-Policy: script-src 'self' *.ageverif.com; img-src 'self' *.ageverif.com i.agvfcdn.com; connect-src 'self' *.ageverif.com; ``` -------------------------------- ### POST /v1/oauth2/token Source: https://docs.ageverif.com/oauth2.html Exchanges the authorization code received from the callback for an access token. ```APIDOC ## POST /v1/oauth2/token ### Description Exchanges the authorization code for an access token to verify the user's age status. ### Method POST ### Endpoint https://api.ageverif.com/v1/oauth2/token ### Parameters #### Request Body - **grant_type** (string) - Required - Must be 'authorization_code'. - **code** (string) - Required - The code received from the redirect. - **redirect_uri** (string) - Required - Must match the original redirect_uri. ### Request Example curl -X POST https://api.ageverif.com/v1/oauth2/token \ -H "Authorization: Basic [base64(client_id:client_secret)]" \ -d "grant_type=authorization_code&code=[code]&redirect_uri=[uri]" ### Response #### Success Response (200) - **access_token** (string) - The token used to access user resources. - **expires_in** (integer) - Token validity duration in seconds. ``` -------------------------------- ### POST /v1/oauth2/token Source: https://docs.ageverif.com/oauth2.html Exchanges the authorization code for an access token to be used for subsequent API requests. ```APIDOC ## POST /v1/oauth2/token ### Description Exchanges the authorization grant code obtained from the redirect URI for an access token. ### Method POST ### Endpoint https://api.ageverif.com/v1/oauth2/token ### Parameters #### Headers - **Authorization** (string) - Required - Basic authentication header using base64(client_id:client_secret). ### Request Example POST https://api.ageverif.com/v1/oauth2/token Authorization: Basic [base64(client_id:client_secret)] ### Response #### Success Response (200) - **access_token** (string) - Token used to authenticate resource requests. ``` -------------------------------- ### Retrieve Verified Visitor Resources Source: https://docs.ageverif.com/oauth2.html Fetches verification details for a visitor using a valid Bearer access token. Returns verification status, country, and assurance level. ```http GET https://api.ageverif.com/v1/oauth2/resources ``` ```bash curl -X GET https://api.ageverif.com/v1/oauth2/resources \ -H "Authorization: Bearer eyJ0eXAiOiJKV1Qi..." ``` ```json { "resources": { "verified": true, "uid": "F1Hkgz2lvaUdF8Ia8WNBL", "country": "US", "country_subdivision": "US-CA", "assurance_level": "STRICT", "age_threshold": 18, "expires_at": 781045200, "expires_in": 3600 } } ``` -------------------------------- ### POST /v1/oauth2/token Source: https://docs.ageverif.com/oauth2.html Exchanges an authorization code for an access token. This token is required to access protected visitor resources. ```APIDOC ## POST /v1/oauth2/token ### Description Exchanges an authorization code for an access token. Authentication can be performed via Authorization header or request body parameters. ### Method POST ### Endpoint https://api.ageverif.com/v1/oauth2/token ### Parameters #### Request Body - **grant_type** (string) - Required - Must be 'authorization_code'. - **code** (string) - Required - Authorization grant code returned from the previous step. - **redirect_uri** (string) - Required - Must match the URI used in the authorization prompt. - **client_id** (string) - Optional - Client identifier if not using Authorization header. - **client_secret** (string) - Optional - Client secret if not using Authorization header. ### Request Example { "grant_type": "authorization_code", "code": "8f0FwyzmlDSfdOiE...", "redirect_uri": "https://www.example.org/oauth2-callback" } ### Response #### Success Response (200) - **token_type** (string) - Hint for token usage (Bearer). - **access_token** (string) - Token used to fetch user data. - **expires_at** (int) - Unix timestamp of expiration. - **expires_in** (int) - Seconds until expiration. #### Response Example { "token_type": "Bearer", "access_token": "eyJ0eXAiOiJKV1Qi...", "expires_at": 781045200, "expires_in": 3600 } ``` -------------------------------- ### Retrieve Website Keys Source: https://docs.ageverif.com/external-api.html Retrieves the public key for a registered website. This operation is performed via an HTTP GET request to the specified endpoint. ```http GET https://webmasters-api.ageverif.com/external/website/{website_id}/key/{environment} ``` -------------------------------- ### Retrieve OAuth2 Configuration Source: https://docs.ageverif.com/external-api.html Retrieves a specific OAuth2 configuration for a registered website. This is done via a GET request and returns details including clientId and clientSecret if the status is 'ACTIVE'. ```http GET https://webmasters-api.ageverif.com/external/website/{website_id}/oauth2/{environment} ``` -------------------------------- ### Initialize and Control AgeVerif Checker Source: https://docs.ageverif.com/checker.html Methods to manage the lifecycle of the age verification checker. Includes starting the verification process, clearing existing verification status, and destroying the instance from the DOM. ```typescript start(forceVerification?: boolean): Promise; clear(): void; destroy(): void; ``` -------------------------------- ### Handle OAuth2 Callback Source: https://docs.ageverif.com/oauth2.html The endpoint on your server that receives the authorization code and state parameter after the user completes the AgeVerif verification. ```http GET https://www.example.org/oauth2-callback ?code=[code] &state=[state] ``` -------------------------------- ### Authorize User via OAuth2 Endpoint Source: https://docs.ageverif.com/oauth2.html Initiates the OAuth2 flow by redirecting the user to the AgeVerif authorization endpoint. Requires client credentials and a redirect URI to handle the authorization code. ```http GET https://api.ageverif.com/v1/oauth2/checker ?response_type=code &client_id=[client_id] &redirect_uri=https://www.example.org/oauth2-callback &scope=read &state=[state] ``` -------------------------------- ### Exchange Authorization Code for Access Token Source: https://docs.ageverif.com/oauth2.html Uses a POST request to the token endpoint to exchange an authorization code for a Bearer access token. Requires client authentication via Basic Auth header or body parameters. ```bash curl -X POST https://api.ageverif.com/v1/oauth2/token \ -H "Authorization: Basic V61LHMuuwahgYDcGnPC5bbWobLw7BzR..." \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "grant_type=authorization_code" \ -d "code=8f0FwyzmlDSfdOiE..." \ -d "redirect_uri=https://www.example.org/oauth2-callback" ``` ```json { "token_type": "Bearer", "access_token": "eyJ0eXAiOiJKV1Qi...", "expires_at": 781045200, "expires_in": 3600 } ``` -------------------------------- ### Exchange Authorization Code for Access Token Source: https://docs.ageverif.com/oauth2.html Exchanges the authorization code for an access token by making a POST request to the AgeVerif token endpoint. The request must include the client credentials in the Authorization header. ```bash curl -X POST https://api.ageverif.com/v1/oauth2/token \ -H "Authorization: Basic [base64(client_id:client_secret)]" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "grant_type=authorization_code" \ -d "code=[code]" \ -d "redirect_uri=https://www.example.org/oauth2-callback" ``` -------------------------------- ### AgeVerif JavaScript API Interface Definition Source: https://docs.ageverif.com/checker.html Defines the TypeScript interface for the AgeVerif API, outlining its properties like verification status, client details, and language, as well as methods for starting, clearing, destroying, and managing event listeners for the checker. ```typescript interface AgeVerif { requiresVerification: boolean; verified: boolean; verification: Verification | null; client: Client; language: Language; start: (props: { forceVerification?: boolean; language?: Language | 'auto'; closable?: boolean; hidden?: boolean; target?: 'popup' | 'tab'; }) => Promise<{ verified: boolean, verification: Verification | null, }>; clear: () => void; destroy: () => void; on: (event: EventName, listener: Listener) => void; off: (event: EventName, listener: Listener) => void; } type Verification = { uid: string; country: string; countrySubdivision: string | null; assuranceLevel: 'STANDARD' | 'ENHANCED' | 'STRICT'; ageThreshold: number; expiresAt: number; expiresIn: number; token: string; }; type Client = { country: string; countryNum: number; countrySubdivision: string | null; } type Language = 'de' | 'en' | 'es' | 'fr' | 'it' | 'pt'; type EventName = 'load' | 'ready' | 'success' | 'close' | 'error'; type Listener = (...args: any[]) => any; ``` -------------------------------- ### POST /external/website/{website_id}/oauth2/{environment} Source: https://docs.ageverif.com/external-api.html Create a new OAuth2 configuration for a registered website. ```APIDOC ## POST /external/website/{website_id}/oauth2/{environment} ### Description Create a new OAuth2 configuration for a registered website. ### Method POST ### Endpoint https://webmasters-api.ageverif.com/external/website/{website_id}/oauth2/{environment} ### Parameters #### Request Body - **redirectUris** (array) - Required - List of allowed redirect URIs. ### Request Example { "redirectUris": ["https://example.com/callback"] } ``` -------------------------------- ### Configure checker.js with URL Query Parameters Source: https://docs.ageverif.com/checker.html This HTML snippet demonstrates how to load the checker.js script with various query parameters to customize its behavior. Parameters control the API key, language, challenges, and callback functions for different events. ```html ``` -------------------------------- ### Retrieve Website API Endpoint Source: https://docs.ageverif.com/external-api.html Fetches the configuration details for a registered website, including public keys for live and test environments. ```http GET https://webmasters-api.ageverif.com/external/website/{website_id} ``` ```typescript interface Response { id: number; name: string; domain: string; language: 'auto' | 'de' | 'en' | 'es' | 'fr' | 'it' | 'pt'; regions: string[]; challenges: ('selfie' | 'email_age' | 'credit_card' | 'ticket' | 'anonymage' | 'pleenk')[]; keys: { environment: 'LIVE' | 'TEST'; publicKey: string; }[]; } ``` -------------------------------- ### Create OAuth2 Configuration Source: https://docs.ageverif.com/external-api.html Creates a new OAuth2 configuration for a registered website. This involves a POST request with a JSON body containing redirect URIs. ```http POST https://webmasters-api.ageverif.com/external/website/{website_id}/oauth2/{environment} ``` -------------------------------- ### Handle AgeVerif Events Source: https://docs.ageverif.com/checker.html Demonstrates different ways to bind to AgeVerif events, including the SDK's internal 'on' method, global window event listeners, and script query parameters. ```javascript ageverif.on('success', ({ verification }) => console.log(verification)); window.addEventListener('ageverif:success', ({ detail: { verification } }) => console.log(verification)); ``` ```html ``` -------------------------------- ### POST /external/website Source: https://docs.ageverif.com/external-api.html Register a new website within the AgeVerif platform. ```APIDOC ## POST /external/website ### Description Register a new website to the AgeVerif service. ### Method POST ### Endpoint https://webmasters-api.ageverif.com/external/website ### Parameters #### Request Body - **name** (string) - Required - Your website name. - **domain** (string) - Required - Your website domain. - **language** (string) - Optional - Forces a given language (default: auto). - **challenges** (array) - Optional - Loads specific challenges (default: all free). - **regions** (array) - Optional - ISO 3166-1/2 country/subdivision codes. ### Request Example { "name": "My Site", "domain": "example.com", "language": "en", "challenges": ["selfie"], "regions": ["US-AL"] } ### Response #### Success Response (200) - **id** (number) - Unique website id. - **name** (string) - Website name. - **domain** (string) - Website domain. - **keys** (object) - Public keys for environments. ``` -------------------------------- ### Create Website API Endpoint Source: https://docs.ageverif.com/external-api.html Registers a new website in the AgeVerif platform. Requires a JSON body with name and domain, and optionally accepts language, challenges, and region configurations. ```http POST https://webmasters-api.ageverif.com/external/website ``` ```typescript interface Request { name: string; domain: string; language?: 'auto' | 'de' | 'en' | 'es' | 'fr' | 'it' | 'pt'; challenges?: ('selfie' | 'email_age' | 'credit_card' | 'ticket' | 'anonymage' | 'pleenk')[]; regions?: string[]; } ``` -------------------------------- ### PATCH /external/website/{website_id}/key/{environment}/regenerate Source: https://docs.ageverif.com/external-api.html Regenerate the public/private key pair for a registered website. ```APIDOC ## PATCH /external/website/{website_id}/key/{environment}/regenerate ### Description Regenerate the public/private key pair for a registered website. ### Method PATCH ### Endpoint https://webmasters-api.ageverif.com/external/website/{website_id}/key/{environment}/regenerate ### Parameters #### Path Parameters - **website_id** (string) - Required - The unique identifier of the website. - **environment** (string) - Required - The environment for the key pair (LIVE or TEST). ### Response #### Success Response (200) - **environment** (string) - The environment for the key pair. - **publicKey** (string) - The new public key for the website. #### Response Example { "environment": "LIVE", "publicKey": "-----BEGIN PUBLIC KEY-----"..." } ``` -------------------------------- ### PATCH /external/website/{website_id}/oauth2/{environment} Source: https://docs.ageverif.com/external-api.html Update an existing OAuth2 configuration for a registered website. ```APIDOC ## PATCH /external/website/{website_id}/oauth2/{environment} ### Description Update an existing OAuth2 configuration for a registered website. At least one of redirectUris or status must be provided. ### Method PATCH ### Endpoint https://webmasters-api.ageverif.com/external/website/{website_id}/oauth2/{environment} ### Parameters #### Request Body - **redirectUris** (array) - Optional - List of allowed redirect URIs. - **status** (string) - Optional - The status to assign (ACTIVE or DISABLED). ### Request Example { "status": "ACTIVE" } ``` -------------------------------- ### Event: 'success' Source: https://docs.ageverif.com/checker.html Triggered when the visitor has been successfully verified and the Checker is closed. ```APIDOC ## Event: 'success' ### Description Triggered when the visitor has been verified and the Checker is closed. Also triggered if the visitor is already verified, after calling `ageverif.start()`. ### Callback Details - **verification** (Object) - Required - Object containing details of the current visitor verification (e.g., `{ uid: '...' }`). ### Implementation Example ```javascript ageverif.on('success', ({ verification }) => { ... }); window.addEventListener('ageverif:success', ({ detail: { verification } }) => { ... }); ``` ``` -------------------------------- ### Create OAuth2 Request Interface Source: https://docs.ageverif.com/external-api.html Defines the structure of the request body for creating an OAuth2 configuration. ```typescript interface Request { redirectUris: string[]; } ``` -------------------------------- ### Authentication Header Configuration Source: https://docs.ageverif.com/external-api.html All API requests require a Bearer token for authentication. Include the token in the Authorization header of your HTTP requests. ```http Authorization: Bearer YOUR_API_KEY ``` -------------------------------- ### PATCH /external/website/{website_id} Source: https://docs.ageverif.com/external-api.html Update the configuration details of an existing registered website. ```APIDOC ## PATCH /external/website/{website_id} ### Description Update details of a registered website. At least one field must be provided. ### Method PATCH ### Endpoint https://webmasters-api.ageverif.com/external/website/{website_id} ### Parameters #### Path Parameters - **website_id** (string) - Required - The unique identifier of the website. #### Request Body - **name** (string) - Optional - Your website name. - **language** (string) - Optional - Forces a given language. - **challenges** (array) - Optional - Loads specific challenges. - **regions** (array) - Optional - ISO 3166-1/2 country/subdivision codes. ### Request Example { "name": "Updated Site Name" } ### Response #### Success Response (200) - **id** (number) - Unique website id. - **name** (string) - Updated website name. ``` -------------------------------- ### Website Key Response Interface Source: https://docs.ageverif.com/external-api.html Defines the structure of the response when retrieving or regenerating website keys. ```typescript interface Response { environment: 'LIVE' | 'TEST'; publicKey: string; } ``` -------------------------------- ### Manage Event Listeners Source: https://docs.ageverif.com/checker.html Methods for registering and removing event listeners to handle verification lifecycle events. Returns a cleanup function for easy listener management. ```typescript on(event: EventName, listener: Listener): () => void; off(event: EventName, listener: Listener): void; ``` -------------------------------- ### Implement Manual AgeVerif Integration Source: https://docs.ageverif.com/checker.html Allows manual triggering of the checker via a button and provides custom logic for handling verification states and UI unblurring. ```html ``` -------------------------------- ### Advanced AgeVerif Checker Integration (HTML) Source: https://docs.ageverif.com/checker.html Integrates the AgeVerif Checker with the 'nostart' parameter for manual control via JavaScript. Paste this script tag before the closing tag. Replace '[KEY]' with your Public Live Key. The 'async' and 'defer' attributes are recommended. ```html ``` ```html ... ... ``` -------------------------------- ### OAuth2 Response Interface Source: https://docs.ageverif.com/external-api.html Defines the structure of the response when retrieving or managing OAuth2 configurations. ```typescript interface Response { environment: 'LIVE' | 'TEST'; redirectUris: string[]; status: 'ACTIVE' | 'DISABLED'; clientId?: string; clientSecret?: string; }; ``` -------------------------------- ### Implement Automatic AgeVerif Integration Source: https://docs.ageverif.com/checker.html Loads the AgeVerif checker to automatically blur content until the visitor completes age verification. ```html ... ``` -------------------------------- ### Regenerate Website Keys Source: https://docs.ageverif.com/external-api.html Regenerates the public/private key pair for a registered website. This operation is performed via an HTTP PATCH request to the specified endpoint. ```http PATCH https://webmasters-api.ageverif.com/external/website/{website_id}/key/{environment}/regenerate ``` -------------------------------- ### Event: 'error' Source: https://docs.ageverif.com/checker.html Triggered when a fatal error prevents the Checker from initializing or proceeding. ```APIDOC ## Event: 'error' ### Description Triggered when a fatal error occurs and the Checker is not able to initialize or proceed. ### Callback Details - **error** (Error) - Required - The error object containing details of the failure. ### Implementation Example ```javascript ageverif.on('error', (error) => { ... }); window.addEventListener('ageverif:error', ({ detail }) => { ... }); ``` ``` -------------------------------- ### Automatic AgeVerif Checker Integration (HTML) Source: https://docs.ageverif.com/checker.html Integrates the AgeVerif Checker automatically on page load. This method requires pasting a script tag into your website's HTML, preferably before the closing tag. Replace '[KEY]' with your website's Public Live Key. ```html ``` ```html ... ... ``` -------------------------------- ### Update Website API Endpoint Source: https://docs.ageverif.com/external-api.html Updates existing website details. At least one optional field (name, language, challenges, or regions) must be provided in the request body. ```http PATCH https://webmasters-api.ageverif.com/external/website/{website_id} ``` ```typescript interface Request { name?: string; language?: 'auto' | 'de' | 'en' | 'es' | 'fr' | 'it' | 'pt'; challenges?: ('selfie' | 'email_age' | 'credit_card' | 'ticket' | 'anonymage' | 'pleenk')[]; regions?: string[]; } ``` -------------------------------- ### Handle AgeVerif Success Event Source: https://docs.ageverif.com/checker.html Triggered when a visitor is successfully verified. Provides a verification object containing user details. ```javascript ageverif.on('success', ({ verification }) => ...); window.addEventListener('ageverif:success', ({ detail: { verification } }) => ...); window.ageverifSuccess = ({ verification }) => ...; ``` -------------------------------- ### Update OAuth2 Configuration Source: https://docs.ageverif.com/external-api.html Updates an existing OAuth2 configuration for a registered website. This operation uses a PATCH request and can modify redirect URIs and the status. ```http PATCH https://webmasters-api.ageverif.com/external/website/{website_id}/oauth2/{environment} ``` -------------------------------- ### Update OAuth2 Request Interface Source: https://docs.ageverif.com/external-api.html Defines the structure of the request body for updating an OAuth2 configuration. Both redirectUris and status are optional, but at least one must be provided. ```typescript interface Request { redirectUris?: string[]; status?: 'ACTIVE' | 'DISABLED'; } ``` -------------------------------- ### AgeVerif API: verification Property Source: https://docs.ageverif.com/checker.html The 'verification' property holds an object with details of the current visitor's verification, or null if not verified. It includes fields like UID, country, assurance level, age threshold, expiry, and a JWT token. ```typescript verification: { uid: string; country: string; countrySubdivision: string | null; assuranceLevel: 'STANDARD' | 'ENHANCED' | 'STRICT'; ageThreshold: number; expiresAt: number; expiresIn: number; token: string; } | null ``` -------------------------------- ### Handle AgeVerif Error Event Source: https://docs.ageverif.com/checker.html Triggered upon initialization or runtime failures. Provides an error object with details regarding the failure. ```javascript ageverif.on('error', (error) => ...); window.addEventListener('ageverif:error', ({ detail }) => ...); window.handleError = (error) => ...; ``` -------------------------------- ### Event: 'close' Source: https://docs.ageverif.com/checker.html Triggered when the Checker and Modal are closed, regardless of verification status. ```APIDOC ## Event: 'close' ### Description Triggered when the Checker and Modal are closed, either by the visitor or automatically after a successful verification. This event is always triggered when the Checker is closed, even if the visitor is not verified. ### Callback Details - **verified** (boolean) - Required - Verification status of the current visitor. ### Implementation Example ```javascript ageverif.on('close', ({ verified }) => { ... }); window.addEventListener('ageverif:close', ({ detail: { verified } }) => { ... }); ``` ``` -------------------------------- ### AgeVerif API: client Property Source: https://docs.ageverif.com/checker.html The 'client' property provides an object with details about the current visitor, including their country (ISO 3166-1 alpha-2 and numeric) and country subdivision (ISO 3166-2). ```typescript client: { country: string; countryNum: number; countrySubdivision: string | null; } ``` -------------------------------- ### Error Response Structure Source: https://docs.ageverif.com/external-api.html Defines the structure of error responses from the API, including a descriptive message, error type, and HTTP status code. ```typescript interface ErrorResponse { message: string; // A descriptive error message error: string; // The type of error statusCode: number; // The HTTP status code } ``` -------------------------------- ### AgeVerif API: verified Property Source: https://docs.ageverif.com/checker.html The 'verified' boolean property reflects the current visitor's verification status. It is true if the visitor has been successfully verified and the session is valid, or if no verification is required. ```typescript verified: boolean ``` -------------------------------- ### Regenerate OAuth2 Client ID/Secret Source: https://docs.ageverif.com/external-api.html Regenerates the client ID and secret for an existing OAuth2 configuration. This requires the OAuth2 status to be 'ACTIVE' and is performed via a PATCH request. ```http PATCH https://webmasters-api.ageverif.com/external/website/{website_id}/oauth2/{environment}/regenerate ``` -------------------------------- ### Handle AgeVerif Close Event Source: https://docs.ageverif.com/checker.html Triggered when the checker modal is closed. Includes a boolean status indicating if the visitor was verified. ```javascript ageverif.on('close', ({ verified }) => ...); window.addEventListener('ageverif:close', ({ detail: { verified } }) => ...); window.ageverifClose = ({ verified }) => ...; ``` -------------------------------- ### AgeVerif API: requiresVerification Property Source: https://docs.ageverif.com/checker.html The 'requiresVerification' boolean property indicates whether the visitor must pass the age verification process for the current region. It is true if verification is required, regardless of whether the visitor is already verified. ```typescript requiresVerification: boolean ``` -------------------------------- ### AgeVerif API: language Property Source: https://docs.ageverif.com/checker.html The 'language' property specifies the language for the Checker and Modal. It can be set to a specific language code or 'auto' to use the visitor's browser language. ```typescript language: 'de' | 'en' | 'es' | 'fr' | 'it' | 'pt' ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.