> For the complete documentation index, see [llms.txt](https://vectis.liesware.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vectis.liesware.com/time-attestation.md).

# Time Attestation

## Attest the local clock with authenticated NTS and verified Roughtime

> Requires the global \`time-attest\` permission granted with \`kid: "\*"\`; this endpoint accepts no KID and no request body. A false acceptable value is a successful measurement that does not meet policy; source failures return 502 without partial observations.

```json
{"openapi":"3.1.0","info":{"title":"Vectis HTTP API","version":"v1"},"tags":[{"name":"Time Attestation"}],"servers":[{"url":"http://127.0.0.1:3000","description":"Local default server over HTTP"},{"url":"https://127.0.0.1:3000","description":"Local HTTPS server when VECTIS_MODE=prod"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-Key"}},"schemas":{"TimeAttestationOutput":{"type":"object","required":["version","provider","sources","server_clock"],"additionalProperties":false,"properties":{"version":{"type":"string","const":"vectis-time-attestation-v1"},"provider":{"type":"string","minLength":1,"maxLength":128,"description":"Provider identifier. V1 supports cloudflare."},"sources":{"type":"object","required":["system","nts","roughtime"],"properties":{"system":{"type":"object","required":["unix_us"],"properties":{"unix_us":{"type":"string","pattern":"^[0-9]+$"}}},"nts":{"type":"object","required":["authenticated","server","offset_us","round_trip_us"],"properties":{"authenticated":{"type":"boolean","const":true},"server":{"type":"string"},"offset_us":{"type":"string","pattern":"^-?[0-9]+$"},"round_trip_us":{"type":"string","pattern":"^[0-9]+$"}}},"roughtime":{"type":"object","required":["verified","server","midpoint_us","radius_us","earliest_us","latest_us","nonce_b64","response_b64"],"properties":{"verified":{"type":"boolean","const":true},"server":{"type":"string"},"midpoint_us":{"type":"string","pattern":"^[0-9]+$"},"radius_us":{"type":"string","pattern":"^[0-9]+$"},"earliest_us":{"type":"string","pattern":"^[0-9]+$"},"latest_us":{"type":"string","pattern":"^[0-9]+$"},"nonce_b64":{"type":"string"},"response_b64":{"type":"string"}}}}},"server_clock":{"type":"object","required":["acceptable","max_allowed_skew_ms","local_vs_nts_skew_ms","local_within_roughtime_interval","nts_within_roughtime_interval"],"properties":{"acceptable":{"type":"boolean"},"max_allowed_skew_ms":{"type":"integer","minimum":1},"local_vs_nts_skew_ms":{"type":"number"},"local_within_roughtime_interval":{"type":"boolean"},"nts_within_roughtime_interval":{"type":"boolean"}}}}},"ErrorResponse":{"type":"object","required":["error"],"properties":{"error":{"$ref":"#/components/schemas/TextField"}}},"TextField":{"type":"string","minLength":1,"pattern":"^[^\\x00-\\x1F\\x7F-\\x9F]+$"}},"responses":{"Error":{"description":"Public error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/time/attest":{"post":{"tags":["Time Attestation"],"summary":"Attest the local clock with authenticated NTS and verified Roughtime","description":"Requires the global `time-attest` permission granted with `kid: \"*\"`; this endpoint accepts no KID and no request body. A false acceptable value is a successful measurement that does not meet policy; source failures return 502 without partial observations.","responses":{"200":{"description":"Complete time attestation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TimeAttestationOutput"}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"502":{"$ref":"#/components/responses/Error"},"default":{"$ref":"#/components/responses/Error"}}}}}}
```
