{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/layers-com/json-schema/layers-com-webhook-endpoint-public-schema-output-schema.json",
  "title": "WebhookEndpointPublicSchemaOutput",
  "x-generated": "2026-11-15",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/layers-com-openapi.json#/components/schemas/WebhookEndpointPublicSchemaOutput",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
      "description": "Unique identifier for the webhook endpoint."
    },
    "organizationId": {
      "description": "Organization that owns this endpoint.",
      "$ref": "#/$defs/OrganizationId"
    },
    "projectId": {
      "anyOf": [
        {
          "$ref": "#/$defs/ProjectId"
        },
        {
          "type": "null"
        }
      ],
      "description": "Project this endpoint is scoped to, or null if it receives events across the whole organization."
    },
    "url": {
      "type": "string",
      "format": "uri",
      "description": "HTTPS URL events are POSTed to."
    },
    "description": {
      "description": "Optional human-readable label for the endpoint, or null if unset.",
      "type": [
        "string",
        "null"
      ]
    },
    "metadata": {
      "anyOf": [
        {
          "$ref": "#/$defs/PartnerOrgMetadataReadSchema"
        },
        {
          "type": "null"
        }
      ],
      "description": "Your opaque key/value pairs attached to the endpoint, or null if none were set."
    },
    "status": {
      "description": "Current delivery state of the endpoint.",
      "$ref": "#/$defs/WebhookEndpointStatusEnum"
    },
    "scope": {
      "description": "Whether the endpoint receives only this organization's events or also those of its child organizations.",
      "$ref": "#/$defs/WebhookEndpointScopeEnum"
    },
    "events": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/WebhookEventTypeEnum"
      },
      "description": "Event types this endpoint is subscribed to."
    },
    "apiVersion": {
      "type": "string",
      "description": "API version the event payloads delivered to this endpoint are formatted against."
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
      "description": "When the endpoint was created (ISO-8601 UTC)."
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
      "description": "When the endpoint was last modified (ISO-8601 UTC)."
    },
    "lastSuccessAt": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
        },
        {
          "type": "null"
        }
      ],
      "description": "When this endpoint last received a successful delivery (ISO-8601 UTC), or null if none yet."
    },
    "lastFailureAt": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
        },
        {
          "type": "null"
        }
      ],
      "description": "When this endpoint last had a failed delivery (ISO-8601 UTC), or null if none yet."
    },
    "consecutiveFailureCount": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991,
      "description": "Number of consecutive failed deliveries; resets to 0 on the next success."
    }
  },
  "required": [
    "id",
    "organizationId",
    "projectId",
    "url",
    "description",
    "metadata",
    "status",
    "scope",
    "events",
    "apiVersion",
    "createdAt",
    "updatedAt",
    "lastSuccessAt",
    "lastFailureAt",
    "consecutiveFailureCount"
  ],
  "additionalProperties": false,
  "$defs": {
    "OrganizationId": {
      "type": "string",
      "minLength": 5,
      "maxLength": 64,
      "pattern": "^org_[A-Za-z0-9-]+$"
    },
    "PartnerOrgMetadataReadSchema": {
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {}
    },
    "ProjectId": {
      "type": "string",
      "minLength": 5,
      "maxLength": 64,
      "pattern": "^prj_[A-Za-z0-9-]+$"
    },
    "WebhookEndpointScopeEnum": {
      "type": "string",
      "enum": [
        "own",
        "all_children"
      ],
      "description": "Which events the endpoint receives: own (default) is only this organization's events; all_children additionally includes every child organization's events."
    },
    "WebhookEndpointStatusEnum": {
      "type": "string",
      "enum": [
        "active",
        "paused",
        "auto_paused"
      ],
      "description": "Endpoint delivery state: active receives events, paused is muted by you, auto_paused was muted automatically after repeated delivery failures."
    },
    "WebhookEventTypeEnum": {
      "type": "string",
      "enum": [
        "job.completed",
        "job.failed",
        "job.canceled",
        "content.generated",
        "content.approved",
        "content.rejected",
        "post.scheduled",
        "post.published",
        "post.failed",
        "post.canceled",
        "social_account.connected",
        "social_account.needs_reauth",
        "social_account.revoked",
        "marketing_bootstrap.completed",
        "marketing_bootstrap.failed",
        "project.created",
        "project.brand_ingest.completed",
        "sdk_app.created",
        "layer.created",
        "influencer.created",
        "ads.account.connected",
        "ads.account.disconnected",
        "ads.token.expired",
        "ads.optimizer.action",
        "ads.optimizer.run.completed",
        "ads.write.executed",
        "ads.write.denied",
        "ads.creative.flagged",
        "ads.creative.unlocked",
        "ads.policy.violation",
        "ads.budget.cap_exceeded",
        "approval.dispatched",
        "approval.dispatch_failed",
        "approval.approved",
        "approval.disapproved",
        "mma.spend.refused",
        "mma.sdk.silent",
        "mma.experiment.read_due",
        "mma.campaign.out_of_geo",
        "mma.rating.drop_after_release",
        "mma.spend.guardrail",
        "test.ping"
      ],
      "description": "The kind of event that triggers a webhook delivery (e.g. content.generated, post.published)."
    }
  }
}