{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/elocuenti-com/json-schema/elocuenti-com-events-response-schema.json",
  "title": "EventsResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/elocuenti-com-events-api-openapi.yml#/components/schemas/EventsResponse",
  "type": "object",
  "properties": {
    "data": {
      "$ref": "#/$defs/EventsResult"
    },
    "request_id": {
      "type": "string",
      "description": "The identifier of this request. Give it to support if you need help.",
      "title": "Request Id"
    },
    "simulated": {
      "description": "Present, and `true`, only when you used a sandbox key: the request was checked and answered as if it had worked, but nothing was saved.",
      "type": "boolean",
      "const": true,
      "title": "Simulated"
    }
  },
  "required": [
    "data",
    "request_id"
  ],
  "$defs": {
    "EventRejection": {
      "type": "object",
      "properties": {
        "index": {
          "type": "integer",
          "description": "The position of the event in your request, starting at 0.",
          "title": "Index"
        },
        "details": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "field": {
                "type": "string",
                "description": "The field that failed, as a path that starts with its position.",
                "title": "Field"
              },
              "issue": {
                "type": "string",
                "description": "What is wrong: an issue any field can have (`required`, `invalid_type`, `invalid_format`, `too_small`, `too_big`, `invalid_value`, `unrecognized_field`) or one specific to events: `identity_required` (no contact named), `not_found` (no contact with that value), `ambiguous` (two contacts share it, like an email: name the contact with `phone`, `external_id` or `contact_id`) or `identity_conflict` (the values name different contacts). It never repeats the value you sent.",
                "title": "Issue"
              }
            },
            "required": [
              "field",
              "issue"
            ]
          },
          "description": "One entry per field that failed.",
          "title": "Details"
        }
      },
      "required": [
        "index",
        "details"
      ],
      "description": "An event that was not recorded, and why.",
      "title": "EventRejection"
    },
    "EventsResult": {
      "type": "object",
      "properties": {
        "accepted": {
          "type": "integer",
          "description": "How many events are new and were recorded. With a sandbox key, how many would have been.",
          "title": "Accepted"
        },
        "duplicates": {
          "type": "array",
          "items": {
            "type": "integer"
          },
          "description": "The positions of the events whose `event` and `event_id` were already recorded. They are not recorded again and you do not need to fix anything.",
          "title": "Duplicates"
        },
        "rejected": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/EventRejection"
          },
          "description": "The events that did not pass, one entry each. Fix those and send them again; the rest are already done.",
          "title": "Rejected"
        }
      },
      "required": [
        "accepted",
        "duplicates",
        "rejected"
      ],
      "description": "What happened to each event of the request.",
      "title": "EventsResult"
    }
  }
}