PingOne Protect API
Protect costs $0.50 per 1,000 successful results. Prepare is free. All prices.
To receive data through one HTTP call, use POST /solve with type: "pingone". The sections below explain token handling, configuration and signed inputs in the SDK.
Advanced: SDK flow
In this flow, you fetch the page and its actual PingOne SDK script, send the token request through your client, and submit the result yourself.
- Fetch the target page and its PingOne SDK script with your target client. Use the same user agent and session as your target flow.
- Create a browser session and page. Pass the script source and a
sendcallback toprotect. - The SDK calls free
/pingone/prepareand passes its token GET request tosend. Send the request using your target transport and return the response. Keep cookies and proxy settings in that transport. - The SDK calls
/pingone/protectand returns encodeddata. Include it in the site's normal request as required by that site.
Use the actual script from the target site, not an example script. The SDK accepts a supplied client token instead of send when you already have one. The SDK retains continuation state and handles gzip and one recovery when retained script state is missing. Keep passing the script source to the SDK.
Python
# page is ng.session(user_agent=ua).page(url, html).
# send(request) uses your target client and returns TargetResponse.
result = page.protect(script=script_source, send=send)
data = result.dataThe async SDK uses await page.protect(...). See the complete Python example for the callback and page and script fetches.
TypeScript
// page is ng.session({ userAgent }).page(url, html).
// send is a TargetFetch backed by your target client.
const result = await page.protect({ script: scriptSource, send });
const data = result.data;See the TypeScript example for the callback. Native fetch has no cookie jar. Use a cookie-aware transport when the target requires one.
Go
// session is client.PingOne.Session(visit), and page belongs to visit.
result, err := session.Protect(ctx, page, pingone.Options{
Script: scriptSource,
Send: target.Do,
})
if err != nil { return err }
data := result.DataSee the Go example. Use the same target client and cookie jar for the page, script, and token request.
Identity and signed inputs
The generated device identity is stable for the same profile UUID, Nullgate API key, and site origin. Changing any of them, including rotating the API key, changes the generated identity. Keep the same profile and key when continuity matters.
You may supply a device attributes JWT as jwt_device_attributes, jwtDeviceAttributes, or JWTDeviceAttributes. The service passes the supplied JWT unchanged. If the site's SDK configuration enables the agent flag, provide the agent JWT as jwt_agent_payload, jwtAgentPayload, or JWTAgentPayload. The service does not create that JWT. Supply other SDK configuration and behavioral data only when available from your flow.
HTTP API and errors
HTTP reference · OpenAPI schema
POST /pingone/prepare is authenticated and free. POST /pingone/protect charges for each successful result, even if the target later rejects it. Invalid requests return HTTP 400. Insufficient balance returns HTTP 402. Missing retained script returns HTTP 428 script_required: retry with the full script. See Errors.