Docly Developers
Function API only Updated 20 Oct 2026

getCookie(name)

Reads a cookie sent with the request. Available in API scripts and the site router.

Parameters

namestringrequired

The cookie name.

Returns

The value as text, or null when the request has no cookie with that name.

Docly's own cookies (auth, auth2, adminoverride, access_token and _doauth_*) always return null — use request.user and request.Jwt. A cookie set with setCookie in the same request is not visible until the next request.

Example

Normal JavaScript, running in the browser or on the Docly™ server.
// #/Services/Router.js — check the state on a sign-in callback
if (!query.state || query.state !== docly.getCookie("oauth_state"))
    return route.text("The sign-in has expired. Please try again.", 400);