{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/ada/main/json-schema/ada-deletion-job-schema.json",
  "title": "DeletionJob",
  "description": "Full state of a deletion job, including the per-identifier outcomes.",
  "x-generated": "2026-10-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ada-getdeletionjob-api-openapi.yml#/components/schemas/DeletionJob",
  "type": "object",
  "properties": {
    "job_id": {
      "type": "string",
      "description": "Identifier of the deletion job."
    },
    "type": {
      "type": "string",
      "description": "The job type."
    },
    "client_reference": {
      "type": [
        "string",
        "null"
      ],
      "description": "The caller-supplied reference from the original request, or null."
    },
    "status": {
      "$ref": "#/$defs/DeletionJobStatus"
    },
    "identifiers": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/IdentifierDisposition"
      },
      "description": "Per-identifier outcomes. Inspect this array to understand exactly what was erased, rather than relying on the top-level status alone."
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Time the job was created, in ISO 8601 format."
    },
    "completed_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "Time the job reached a terminal state, in ISO 8601 format, or null while the job is still running."
    },
    "failure_reason": {
      "type": [
        "string",
        "null"
      ],
      "description": "Opaque, machine-readable diagnostic present only when `status` is `failed`, or null otherwise. This value is subject to change; to understand outcomes per identifier, inspect each identifier's `disposition` and `reason`."
    }
  },
  "$defs": {
    "DeletionIdentifierType": {
      "type": "string",
      "enum": [
        "email",
        "chatter_id",
        "external_id",
        "end_user_id",
        "variable_match"
      ],
      "description": "The kind of identifier supplied. `variable_match` selects every end user whose stored variable equals the value.",
      "title": "DeletionIdentifierType"
    },
    "DeletionJobStatus": {
      "type": "string",
      "enum": [
        "queued",
        "in_progress",
        "completed",
        "partial",
        "failed"
      ],
      "description": "Lifecycle state of a deletion job. `queued` and `in_progress` are non-terminal; `completed`, `partial`, and `failed` are terminal.",
      "title": "DeletionJobStatus"
    },
    "IdentifierDisposition": {
      "type": "object",
      "properties": {
        "type": {
          "$ref": "#/$defs/DeletionIdentifierType"
        },
        "value": {
          "type": "string",
          "description": "The identifier value as submitted."
        },
        "variable": {
          "type": [
            "string",
            "null"
          ],
          "description": "The matched variable name, or null when not applicable."
        },
        "disposition": {
          "$ref": "#/$defs/IdentifierDispositionDisposition",
          "description": "How the identifier was handled. `accepted` identifiers are queued for erasure; the other values indicate the identifier contributed no erasure."
        },
        "matched_chatters": {
          "type": "integer",
          "description": "Number of end users matched by this identifier."
        },
        "reason": {
          "type": [
            "string",
            "null"
          ],
          "description": "Human-readable explanation for a non-accepted disposition. Always set for `invalid` and `exceeds_limit`, and for `not_found` on ID-based identifiers; may be null for a `not_found` `email` or `variable_match` selector, and for `accepted`/`duplicate`. Do not assume it is non-null from `disposition` alone."
        }
      },
      "description": "The outcome for one submitted identifier.",
      "title": "IdentifierDisposition"
    },
    "IdentifierDispositionDisposition": {
      "type": "string",
      "enum": [
        "accepted",
        "not_found",
        "invalid",
        "exceeds_limit",
        "duplicate"
      ],
      "description": "How the identifier was handled. `accepted` identifiers are queued for erasure; the other values indicate the identifier contributed no erasure.",
      "title": "IdentifierDispositionDisposition"
    }
  }
}