{"id":19745175,"url":"https://github.com/castle/json-schemas","last_synced_at":"2026-06-09T02:32:13.869Z","repository":{"id":55984476,"uuid":"251453512","full_name":"castle/json-schemas","owner":"castle","description":"Public JSON Schemas for the Castle API","archived":false,"fork":false,"pushed_at":"2020-12-02T23:11:50.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-02-28T07:39:51.043Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/castle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-30T23:39:48.000Z","updated_at":"2022-08-12T19:20:36.000Z","dependencies_parsed_at":"2022-08-15T10:50:25.874Z","dependency_job_id":null,"html_url":"https://github.com/castle/json-schemas","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/castle/json-schemas","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/castle%2Fjson-schemas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/castle%2Fjson-schemas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/castle%2Fjson-schemas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/castle%2Fjson-schemas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/castle","download_url":"https://codeload.github.com/castle/json-schemas/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/castle%2Fjson-schemas/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34089327,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T02:04:39.831Z","updated_at":"2026-06-09T02:32:13.841Z","avatar_url":"https://github.com/castle.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Castle API JSON Schemas\n\n## Requests to `/track` and `/authenticate`\n\n```json\n{\n  \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n  \"$id\": \"http://api.castle.io/schemas/v0.1/request_event.json\",\n  \"title\": \"Castle Event Context\",\n  \"description\": \"Event information sent to Castle's /track or /authenticate endpoints\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"sent_at\": {\n      \"description\": \"ISO 8601 timestamp for event creation\",\n      \"type\": \"string\",\n      \"pattern\": \"^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(.[0-9]{3})(Z)?$\"\n    },\n    \"event\": {\n      \"oneOf\": [\n        { \"$ref\": \"#/definitions/user_id_events\" },\n        { \"$ref\": \"#/definitions/anonymous_events\" },\n        { \"$ref\": \"#/definitions/command_events\" }\n      ]\n    },\n    \"user_id\": {\n      \"description\": \"A unique user identifier\",\n      \"type\": \"string\"\n    },\n    \"user_traits\": {\n      \"description\": \"Known traits of the identified user\",\n      \"type\": \"object\",\n      \"properties\": {\n        \"email\": {\n          \"description\": \"The identified user's email address\",\n          \"type\": \"string\",\n          \"pattern\": \"^\\\\S+@\\\\S+.[a-zA-Z]\\\\S+$\"\n        },\n        \"registered_at\": {\n          \"description\": \"The timestamp of the user's account creation. Useful for determining newly registered accounts\",\n          \"type\": \"string\"\n        }\n      }\n    },\n    \"properties\": {\n      \"description\": \"Optional event properties to be stored in the Castle environment\",\n      \"type\": \"object\"\n    },\n    \"context\": {\n      \"description\": \"Event context properties\",\n      \"type\": \"object\",\n      \"properties\": {\n        \"client_id\": {\n          \"description\": \"The Castle mobile SDK or c.js fingerprint value. unavailable, set to boolean false\",\n          \"type\": [\"boolean\", \"string\"],\n          \"default\": null\n        },\n        \"ip\": {\n          \"description\": \"The IPv4 or IPv6 address of the originating request. Must be a valid, public IP\",\n          \"type\": \"string\",\n          \"oneOf\": [\n            {\n              \"pattern\": \"^(?!(10\\\\.|172\\\\.(1[6-9]|2[0-9]|3[01])\\\\.|192\\\\.168\\\\.).*)(?!255\\\\.255\\\\.255\\\\.255)(25[0-5]|2[0-4][0-9]|[1][0-9][0-9]|[1-9][0-9]|[1-9])(\\\\.(25[0-5]|2[0-4][0-9]|[1][0-9][0-9]|[1-9][0-9]|[0-9])){3}$\"\n            },\n            {\n              \"pattern\": \"^([A-Fa-f0-9]{1,4}::?){1,7}[A-Fa-f0-9]{1,4}$\"\n            }\n          ]\n        },\n        \"user_agent\": {\n          \"description\": \"The User-Agent of the originating request\",\n          \"type\": \"string\"\n        },\n        \"headers\": {\n          \"description\": \"The Headers object of the originating request. Optional, but highly recommended\",\n          \"type\": \"object\"\n        }\n      },\n      \"required\": [\"client_id\", \"ip\", \"user_agent\"]\n    },\n    \"device_token\": {\n      \"description\": \"The device token, if available/applicable\",\n      \"type\": \"string\",\n      \"pattern\": \"^\\\\S+$\"\n    }\n  },\n  \"required\": [\"event\", \"context\"],\n  \"allOf\": [\n    {\n      \"if\": {\n        \"properties\": { \"event\": { \"$ref\": \"#/definitions/user_id_events\" } }\n      },\n      \"then\": {\n        \"required\": [\"user_id\"]\n      }\n    },\n    {\n      \"if\": {\n        \"properties\": { \"event\": { \"$ref\": \"#/definitions/command_events\" } }\n      },\n      \"then\": {\n        \"required\": [\"device_token\"]\n      }\n    }\n  ],\n  \"definitions\": {\n    \"user_id_events\": {\n      \"description\": \"Event names where user_id is required\",\n      \"type\": \"string\",\n      \"enum\": [\n        \"$login.succeeded\",\n        \"$logout.succeeded\",\n        \"$profile_update.succeeded\",\n        \"$profile_update.failed\",\n        \"$registration.succeeded\",\n        \"$registration.failed\",\n        \"$password_reset.succeeded\",\n        \"$password_reset.failed\",\n        \"$password_reset_request.succeeded\",\n        \"$password_reset_request.failed\",\n        \"$incident.mitigated\",\n        \"$challenge.requested\",\n        \"$challenge.succeeded\",\n        \"$challenge.failed\",\n        \"$transaction.attempted\",\n        \"$session.extended\"\n      ]\n    },\n    \"anonymous_events\": {\n      \"description\": \"Event names that do not require user_id\",\n      \"type\": \"string\",\n      \"enum\": [\"$login.failed\"]\n    },\n    \"command_events\": {\n      \"description\": \"Event names for responding to incident reviews\",\n      \"type\": \"string\",\n      \"enum\": [\"$review.resolved\", \"$review.escalated\"]\n    }\n  }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcastle%2Fjson-schemas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcastle%2Fjson-schemas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcastle%2Fjson-schemas/lists"}