Ingest Web Vital REST API
POST
/ingest/web-vitals
const url = 'https://app.hitkeep.com/ingest/web-vitals';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"mid":"example","n":"LCP","nt":"example","p":"example","pid":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","sid":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","tsrc":"example","tv":"example","v":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://app.hitkeep.com/ingest/web-vitals \ --header 'Content-Type: application/json' \ --data '{ "mid": "example", "n": "LCP", "nt": "example", "p": "example", "pid": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "sid": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "tsrc": "example", "tv": "example", "v": 1 }'Ingests one compact opt-in Web Vital sample from hk-vitals.js. The server resolves the site from Origin, derives the rating from standard thresholds, and strips browser-provided query strings or hashes from the path.
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
mid
Optional web-vitals metric instance ID used for future dedupe and bfcache analysis.
string
n
required
Metric name.
string
nt
Navigation type.
string
p
required
Browser path. Query strings and hashes are stripped server-side.
string
pid
required
string format: uuid
sid
required
string format: uuid
tsrc
string
tv
string
v
required
Metric value. LCP, INP, FCP, and TTFB use milliseconds. CLS is unitless.
number
Responses
Section titled “Responses”Accepted
Invalid request
Media typeapplication/json
object
message
string
Examplegenerated
{ "message": "example"}