WorkOS · Schema

EventSchema

An event emitted by WorkOS.

AuthenticationIdentity ProviderSSOSAMLOIDCSCIMDirectory SyncAuthorizationFGAAudit LogsMFAB2B SaaSAgentsMCP
View JSON Schema on GitHub

JSON Schema

workos-eventschema-schema.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/EventSchema",
  "title": "EventSchema",
  "allOf": [
    {
      "type": "object",
      "properties": {
        "object": {
          "type": "string",
          "description": "Distinguishes the Event object.",
          "const": "event"
        },
        "id": {
          "type": "string",
          "description": "Unique identifier for the Event.",
          "example": "event_01EHZNVPK3SFK441A1RGBFSHRT"
        },
        "event": {
          "type": "string",
          "description": "The type of event that occurred.",
          "example": "dsync.user.created"
        },
        "data": {
          "type": "object",
          "additionalProperties": {},
          "description": "The event payload.",
          "example": {
            "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ",
            "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
            "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
            "state": "active",
            "email": "[email protected]",
            "emails": [
              {
                "primary": true,
                "type": "work",
                "value": "[email protected]"
              }
            ],
            "idp_id": "2836",
            "object": "directory_user",
            "username": "[email protected]",
            "last_name": "Torp",
            "first_name": "Veda",
            "raw_attributes": {},
            "custom_attributes": {},
            "created_at": "2021-06-25T19:07:33.155Z",
            "updated_at": "2021-06-25T19:07:33.155Z"
          }
        },
        "created_at": {
          "format": "date-time",
          "type": "string",
          "description": "An ISO 8601 timestamp.",
          "example": "2026-01-15T12:00:00.000Z"
        },
        "context": {
          "type": "object",
          "additionalProperties": {},
          "description": "Additional context about the event."
        }
      },
      "required": [
        "object",
        "id",
        "event",
        "data",
        "created_at"
      ],
      "description": "An event emitted by WorkOS.",
      "example": {
        "object": "event",
        "id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
        "event": "dsync.user.created",
        "data": {
          "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ",
          "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
          "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
          "state": "active",
          "email": "[email protected]",
          "emails": [
            {
              "primary": true,
              "type": "work",
              "value": "[email protected]"
            }
          ],
          "idp_id": "2836",
          "object": "directory_user",
          "username": "[email protected]",
          "last_name": "Torp",
          "first_name": "Veda",
          "raw_attributes": {},
          "custom_attributes": {},
          "created_at": "2021-06-25T19:07:33.155Z",
          "updated_at": "2021-06-25T19:07:33.155Z"
        },
        "created_at": "2021-06-25T19:07:33.155Z",
        "context": {}
      }
    },
    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "description": "Unique identifier for the event.",
              "example": "event_01EHZNVPK3SFK441A1RGBFSHRT"
            },
            "event": {
              "type": "string",
              "const": "action.authentication.denied"
            },
            "data": {
              "type": "object",
              "properties": {
                "action_endpoint_id": {
                  "type": "string",
                  "description": "The ID of the action endpoint.",
                  "example": "action_endpoint_01EHWNCE74X7JSDV0X3SZ3KJNY"
                },
                "action_execution_id": {
                  "type": "string",
                  "description": "The ID of the action execution.",
                  "example": "action_execution_01EHWNCE74X7JSDV0X3SZ3KJNY"
                },
                "type": {
                  "type": "string",
                  "description": "The type of action that was denied.",
                  "const": "authentication"
                },
                "verdict": {
                  "type": "string",
                  "description": "The verdict of the action.",
                  "const": "Deny"
                },
                "user_id": {
                  "type": "string",
                  "description": "The ID of the user.",
                  "example": "user_01EHWNCE74X7JSDV0X3SZ3KJNY"
                },
                "organization_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The ID of the organization.",
                  "example": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"
                },
                "email": {
                  "type": "string",
                  "description": "The email address of the user.",
                  "example": "[email protected]"
                },
                "ip_address": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The IP address of the request.",
                  "example": "203.0.113.1"
                },
                "user_agent": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The user agent of the request.",
                  "example": "Mozilla/5.0"
                }
              },
              "required": [
                "action_endpoint_id",
                "action_execution_id",
                "type",
                "verdict",
                "user_id",
                "organization_id",
                "email",
                "ip_address",
                "user_agent"
              ],
              "description": "The event payload."
            },
            "context": {
              "$ref": "#/components/schemas/EventContextDto"
            },
            "created_at": {
              "format": "date-time",
              "type": "string",
              "description": "An ISO 8601 timestamp.",
              "example": "2026-01-15T12:00:00.000Z"
            },
            "object": {
              "type": "string",
              "description": "Distinguishes the Event object.",
              "const": "event"
            }
          },
          "required": [
            "id",
            "event",
            "data",
            "created_at",
            "object"
          ]
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "description": "Unique identifier for the event.",
              "example": "event_01EHZNVPK3SFK441A1RGBFSHRT"
            },
            "event": {
              "type": "string",
              "const": "action.user_registration.denied"
            },
            "data": {
              "type": "object",
              "properties": {
                "action_endpoint_id": {
                  "type": "string",
                  "description": "The ID of the action endpoint.",
                  "example": "action_endpoint_01EHWNCE74X7JSDV0X3SZ3KJNY"
                },
                "action_execution_id": {
                  "type": "string",
                  "description": "The ID of the action execution.",
                  "example": "action_execution_01EHWNCE74X7JSDV0X3SZ3KJNY"
                },
                "type": {
                  "type": "string",
                  "description": "The type of action that was denied.",
                  "const": "user_registration"
                },
                "verdict": {
                  "type": "string",
                  "description": "The verdict of the action.",
                  "const": "Deny"
                },
                "organization_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The ID of the organization.",
                  "example": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"
                },
                "email": {
                  "type": "string",
                  "description": "The email address of the user.",
                  "example": "[email protected]"
                },
                "ip_address": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The IP address of the request.",
                  "example": "203.0.113.1"
                },
                "user_agent": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The user agent of the request.",
                  "example": "Mozilla/5.0"
                }
              },
              "required": [
                "action_endpoint_id",
                "action_execution_id",
                "type",
                "verdict",
                "organization_id",
                "email",
                "ip_address",
                "user_agent"
              ],
              "description": "The event payload."
            },
            "context": {
              "$ref": "#/components/schemas/EventContextDto"
            },
            "created_at": {
              "format": "date-time",
              "type": "string",
              "description": "An ISO 8601 timestamp.",
              "example": "2026-01-15T12:00:00.000Z"
            },
            "object": {
              "type": "string",
              "description": "Distinguishes the Event object.",
              "const": "event"
            }
          },
          "required": [
            "id",
            "event",
            "data",
            "created_at",
            "object"
          ]
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "description": "Unique identifier for the event.",
              "example": "event_01EHZNVPK3SFK441A1RGBFSHRT"
            },
            "event": {
              "type": "string",
              "const": "api_key.created"
            },
            "data": {
              "type": "object",
              "properties": {
                "object": {
                  "type": "string",
                  "description": "Distinguishes the API key object.",
                  "const": "api_key"
                },
                "id": {
                  "type": "string",
                  "description": "Unique identifier of the API key.",
                  "example": "api_key_01EHWNCE74X7JSDV0X3SZ3KJNY"
                },
                "owner": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "The type of the API key owner.",
                          "const": "organization"
                        },
                        "id": {
                          "type": "string",
                          "description": "The unique identifier of the API key owner.",
                          "example": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"
                        }
                      },
                      "required": [
                        "type",
                        "id"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "The type of the API key owner.",
                          "const": "user"
                        },
                        "id": {
                          "type": "string",
                          "description": "The unique identifier of the user who owns the API key.",
                          "example": "user_01EHWNCE74X7JSDV0X3SZ3KJNY"
                        },
                        "organization_id": {
                          "type": "string",
                          "description": "The unique identifier of the organization the API key belongs to.",
                          "example": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"
                        }
                      },
                      "required": [
                        "type",
                        "id",
                        "organization_id"
                      ]
                    }
                  ],
                  "description": "The owner of the API key."
                },
                "name": {
                  "type": "string",
                  "description": "The name of the API key.",
                  "example": "My API Key"
                },
                "obfuscated_value": {
                  "type": "string",
                  "description": "The obfuscated value of the API key.",
                  "example": "sk_test_...1234"
                },
                "last_used_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The timestamp when the API key was last used.",
                  "example": "2026-01-15T12:00:00.000Z"
                },
                "permissions": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "The permissions granted to the API key.",
                  "example": [
                    "users:read",
                    "users:write"
                  ]
                },
                "created_at": {
                  "type": "string",
                  "description": "The timestamp when the API key was created.",
                  "example": "2026-01-15T12:00:00.000Z"
                },
                "updated_at": {
                  "type": "string",
                  "description": "The timestamp when the API key was last updated.",
                  "example": "2026-01-15T12:00:00.000Z"
                }
              },
              "required": [
                "object",
                "id",
                "owner",
                "name",
                "obfuscated_value",
                "last_used_at",
                "permissions",
                "created_at",
                "updated_at"
              ],
              "description": "The event payload."
            },
            "created_at": {
              "format": "date-time",
              "type": "string",
              "description": "An ISO 8601 timestamp.",
              "example": "2026-01-15T12:00:00.000Z"
            },
            "context": {
              "$ref": "#/components/schemas/EventContextDto"
            },
            "object": {
              "type": "string",
              "description": "Distinguishes the Event object.",
              "const": "event"
            }
          },
          "required": [
            "id",
            "event",
            "data",
            "created_at",
            "object"
          ]
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "description": "Unique identifier for the event.",
              "example": "event_01EHZNVPK3SFK441A1RGBFSHRT"
            },
            "event": {
              "type": "string",
              "const": "api_key.revoked"
            },
            "data": {
              "type": "object",
              "properties": {
                "object": {
                  "type": "string",
                  "description": "Distinguishes the API key object.",
                  "const": "api_key"
                },
                "id": {
                  "type": "string",
                  "description": "Unique identifier of the API key.",
                  "example": "api_key_01EHWNCE74X7JSDV0X3SZ3KJNY"
                },
                "owner": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "The type of the API key owner.",
                          "const": "organization"
                        },
                        "id": {
                          "type": "string",
                          "description": "The unique identifier of the API key owner.",
                          "example": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"
                        }
                      },
                      "required": [
                        "type",
                        "id"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "The type of the API key owner.",
                          "const": "user"
                        },
                        "id": {
                          "type": "string",
                          "description": "The unique identifier of the user who owns the API key.",
                          "example": "user_01EHWNCE74X7JSDV0X3SZ3KJNY"
                        },
                        "organization_id": {
                          "type": "string",
                          "description": "The unique identifier of the organization the API key belongs to.",
                          "example": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"
                        }
                      },
                      "required": [
                        "type",
                        "id",
                        "organization_id"
                      ]
                    }
                  ],
                  "description": "The owner of the API key."
                },
                "name": {
                  "type": "string",
                  "description": "The name of the API key.",
                  "example": "My API Key"
                },
                "obfuscated_value": {
                  "type": "string",
                  "description": "The obfuscated value of the API key.",
                  "example": "sk_test_...1234"
                },
                "last_used_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The timestamp when the API key was last used.",
                  "example": "2026-01-15T12:00:00.000Z"
                },
                "permissions": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "The permissions granted to the API key.",
                  "example": [
                    "users:read",
                    "users:write"
                  ]
                },
                "created_at": {
                  "type": "string",
                  "description": "The timestamp when the API key was created.",
                  "example": "2026-01-15T12:00:00.000Z"
                },
                "updated_at": {
                  "type": "string",
                  "description": "The timestamp when the API key was last updated.",
                  "example": "2026-01-15T12:00:00.000Z"
                }
              },
              "required": [
                "object",
                "id",
                "owner",
                "name",
                "obfuscated_value",
                "last_used_at",
                "permissions",
                "created_at",
                "updated_at"
              ],
              "description": "The event payload."
            },
            "created_at": {
              "format": "date-time",
              "type": "string",
              "description": "An ISO 8601 timestamp.",
              "example": "2026-01-15T12:00:00.000Z"
            },
            "context": {
              "$ref": "#/components/schemas/EventContextDto"
            },
            "object": {
              "type": "string",
              "description": "Distinguishes the Event object.",
              "const": "event"
            }
          },
          "required": [
            "id",
            "event",
            "data",
            "created_at",
            "object"
          ]
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "description": "Unique identifier for the event.",
              "example": "event_01EHZNVPK3SFK441A1RGBFSHRT"
            },
            "event": {
              "type": "string",
              "const": "authentication.email_verification_failed"
            },
            "data": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "email_verification"
                },
                "status": {
                  "type": "string",
                  "const": "failed"
                },
                "ip_address": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The IP address of the request.",
                  "example": "203.0.113.42"
                },
                "user_agent": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The user agent of the request.",
                  "example": "Mozilla/5.0"
                },
                "user_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The ID of the user.",
                  "example": "user_01E4ZCR3C56J083X43JQXF3JK5"
                },
                "email": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The email address of the user.",
                  "example": "[email protected]"
                },
                "error": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string",
                      "description": "The error code.",
                      "example": "mfa_challenge_failed"
                    },
                    "message": {
                      "type": "string",
                      "description": "A human-readable error message.",
                      "example": "The MFA challenge has failed."
                    }
                  },
                  "required": [
                    "code",
                    "message"
                  ],
                  "description": "Details about the authentication error."
                }
              },
              "required": [
                "type",
                "status",
                "ip_address",
                "user_agent",
                "user_id",
                "email",
                "error"
              ],
              "description": "The event payload."
            },
            "created_at": {
              "format": "date-time",
              "type": "string",
              "description": "An ISO 8601 timestamp.",
              "example": "2026-01-15T12:00:00.000Z"
            },
            "context": {
              "$ref": "#/components/schemas/EventContextDto"
            },
            "object": {
              "type": "string",
              "description": "Distinguishes the Event object.",
              "const": "event"
            }
          },
          "required": [
            "id",
            "event",
            "data",
            "created_at",
            "object"
          ]
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "description": "Unique identifier for the event.",
              "example": "event_01EHZNVPK3SFK441A1RGBFSHRT"
            },
            "event": {
              "type": "string",
              "const": "authentication.email_verification_succeeded"
            },
            "data": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "email_verification"
                },
                "status": {
                  "type": "string",
                  "const": "succeeded"
                },
                "ip_address": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The IP address of the request.",
                  "example": "203.0.113.42"
                },
                "user_agent": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The user agent of the request.",
                  "example": "Mozilla/5.0"
                },
                "user_id": {
                  "type": "string",
                  "description": "The ID of the user.",
                  "example": "user_01E4ZCR3C56J083X43JQXF3JK5"
                },
                "email": {
                  "type": "string",
                  "description": "The email address of the user.",
                  "example": "[email protected]"
                }
              },
              "required": [
                "type",
                "status",
                "ip_address",
                "user_agent",
                "user_id",
                "email"
              ],
              "description": "The event payload."
            },
            "created_at": {
              "format": "date-time",
              "type": "string",
              "description": "An ISO 8601 timestamp.",
              "example": "2026-01-15T12:00:00.000Z"
            },
            "context": {
              "$ref": "#/components/schemas/EventContextDto"
            },
            "object": {
              "type": "string",
              "description": "Distinguishes the Event object.",
              "const": "event"
            }
          },
          "required": [
            "id",
            "event",
            "data",
            "created_at",
            "object"
          ]
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "description": "Unique identifier for the event.",
              "example": "event_01EHZNVPK3SFK441A1RGBFSHRT"
            },
            "event": {
              "type": "string",
              "const": "authentication.magic_auth_failed"
            },
            "data": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "magic_auth"
                },
                "status": {
                  "type": "string",
                  "const": "failed"
                },
                "ip_address": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The IP address of the request.",
                  "example": "203.0.113.42"
                },
                "user_agent": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The user agent of the request.",
                  "example": "Mozilla/5.0"
                },
                "user_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The ID of the user.",
                  "example": "user_01E4ZCR3C56J083X43JQXF3JK5"
                },
                "email": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The email address of the user.",
                  "example": "[email protected]"
                },
                "error": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string",
                      "description": "The error code.",
                      "example": "mfa_challenge_failed"
                    },
                    "message": {
                      "type": "string",
                      "description": "A human-readable error message.",
                      "example": "The MFA challenge has failed."
                    }
                  },
                  "required": [
                    "code",
                    "message"
                  ],
                  "description": "Details about the authentication error."
                }
              },
              "required": [
                "type",
                "status",
                "ip_address",
                "user_agent",
                "user_id",
                "email",
                "error"
              ],
              "description": "The event payload."
            },
            "created_at": {
              "format": "date-time",
              "type": "string",
              "description": "An ISO 8601 timestamp.",
              "example": "2026-01-15T12:00:00.000Z"
            },
            "context": {
              "$ref": "#/components/schemas/EventContextDto"
            },
            "object": {
              "type": "string",
              "description": "Distinguishes the Event object.",
              "const": "event"
            }
          },
          "required": [
            "id",
            "event",
            "data",
            "created_at",
            "object"
          ]
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "description": "Unique identifier for the event.",
              "example": "event_01EHZNVPK3SFK441A1RGBFSHRT"
            },
            "event": {
              "type": "string",
              "const": "authentication.magic_auth_succeeded"
            },
            "data": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "magic_auth"
                },
                "status": {
                  "type": "string",
                  "const": "succeeded"
                },
                "ip_address": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The IP address of the request.",
                  "example": "203.0.113.42"
                },
                "user_agent": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The user agent of the request.",
                  "example": "Mozilla/5.0"
                },
                "user_id": {
                  "type": "string",
                  "description": "The ID of the user.",
                  "example": "user_01E4ZCR3C56J083X43JQXF3JK5"
                },
                "email": {
                  "type": "string",
                  "description": "The email address of the user.",
                  "example": "[email protected]"
                }
              },
              "required": [
                "type",
                "status",
                "ip_address",
                "user_agent",
                "user_id",
                "email"
              ],
              "description": "The event payload."
            },
            "created_at": {
              "format": "date-time",
              "type": "string",
              "description": "An ISO 8601 timestamp.",
              "

# --- truncated at 32 KB (338 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/workos/refs/heads/main/json-schema/workos-eventschema-schema.json