---
title: "Producing Issue Occurrences"
url: https://develop.sentry.dev/backend/issue-platform/producing-occurrences/
---

# Producing Issue Occurrences | Sentry Docs

Normally, detectors handle the job of producing issue occurrences. However, there are cases where you want to produce issue occurrence programmatically. This article covers the mechanism for doing so.

## [Send Payloads to the Issue Platform](https://develop.sentry.dev/backend/issue-platform/producing-occurrences.md#send-payloads-to-the-issue-platform)

If operating within the Sentry codebase, you can call [sentry.issues.produce\_occurrence\_to\_kafka](https://github.com/getsentry/sentry/blob/master/src/sentry/issues/producer.py#L41-L46) with the following optional parameters:

* `payload_type`: [PayloadType](https://develop.sentry.dev/backend/issue-platform/producing-occurrences.md#payload-type)

* one of the following, per `payload_type`

  * `occurrence`: [IssueOccurrence](https://github.com/getsentry/sentry/blob/d262bbd9d8d3a2747d5251bee35c016c13ca050a/src/sentry/issues/issue_occurrence.py#L58)
  * `status_change`: [StatusChange](https://github.com/getsentry/sentry/blob/7fd40bc33607e727ea2fac0183bd04f4ad298ba3/src/sentry/issues/status_change_message.py#L15)

* `event_data`: Dict\[str, Any]

If operating from an external service, pass a json payload that matches the [Issue Occurrence Schema](https://develop.sentry.dev/backend/issue-platform/producing-occurrences.md#issue-occurrence-schema) to the `ingest-occurrences` topic on the [issue occurrences Kafka cluster](https://github.com/getsentry/getsentry/blob/97039335a29517a7e48149148cdd7a30a60971e7/getsentry/conf/settings/prod.py#L567-L571).

### [Payload Type](https://develop.sentry.dev/backend/issue-platform/producing-occurrences.md#payload-type)

Determines the type of payload sent to the issue platform. By default, `payload_type` is set to `OCCURRENCE`.

The [PayloadType](https://github.com/getsentry/sentry/blob/2e5a39ff3dd4afbd33f2ff7d2ba161285107afe4/src/sentry/issues/producer.py#L23) enum has two types:

* `OCCURRENCE`: for sending an occurrence
* `STATUS_CHANGE`: for sending a status update

### [Issue Occurrence Schema](https://develop.sentry.dev/backend/issue-platform/producing-occurrences.md#issue-occurrence-schema)

[Schema](https://github.com/getsentry/sentry/blob/ccfb37212102945df5f35e8f55fe38891b70036b/src/sentry/issues/issue_occurrence.py#L23-L36)

Required:

* `id`: str
  * A user generated uuid in string format representing a unique id for this occurrence. Generally it's a good idea to generate this separately to your event id.
* `project_id`: int
  * Id of the project this occurred in.
* `fingerprint`: Sequence\[str]
  * Unique identifier for the root cause of this problem. Used for aggregating occurrences together into groups.
* `issue_title`: str
  * A short description of the problem. This will be used as the title of the issue and also used in notifications.
* `subtitle`: str
  * Extra detail about the issue, displayed below the `issue_title`.
* `culprit`: str
  * Where the problem occurred. This could be an api path, a function path, etc.
* `evidence_data`: Mapping\[str, Any]
  * An arbitrary map of data. The issue platform doesn't make use of this data directly, it just make it available for use on the frontend and in notifications. This can be used to customize the issue details UI, notifications and so on.
* `evidence_display`: Sequence\[[IssueEvidence](https://develop.sentry.dev/backend/issue-platform/producing-occurrences.md#issue-evidence-schema)]
  * A sequence of `IssueEvidence` entries. These are used to display generic information about your issue in the issue details UI and in various notifications. Even if you are customizing the UI and email, it's recommended to include this so that we can display information correctly on all our other integrations. Typically, these will be displayed in a table when space allows. For space limited integrations we'll display one row that is labelled `important` if available.
* `type`: int
  * The type of issue you are creating. Maps to `type_id` in your registered `GroupType`.
* `detection_time`: float
  * A timestamp representing when the issue was detected.
* `level`: str
  * `Info`, `Warning`, or `Error`.

One of:

* `event_id`: str
  * The event id of an existing event, typically this would be an error or transaction id.
* `event`: [Event](https://develop.sentry.dev/backend/issue-platform/producing-occurrences.md#event-schema)

Optional:

* `resource_id`: str | None
  * An identifier used to link to an external system to load data. For example, this could be an id that we use to build a link to a specific product page.

### [Issue Evidence Schema](https://develop.sentry.dev/backend/issue-platform/producing-occurrences.md#issue-evidence-schema)

[Schema](https://github.com/getsentry/sentry/blob/ccfb37212102945df5f35e8f55fe38891b70036b/src/sentry/issues/issue_occurrence.py#L17-L20)

Required:

* `name`: str
* `value`: str
* `important`: bool
  * Whether this entry contains important data to display to the user. One entry should be marked as important, and it will be displayed in space constrained integrations.

### [Event Schema](https://develop.sentry.dev/backend/issue-platform/producing-occurrences.md#event-schema)

[Schema](https://github.com/getsentry/sentry/blob/ccfb37212102945df5f35e8f55fe38891b70036b/src/sentry/issues/json_schemas.py#L3)

The event schema should match the [Sentry event schema](https://develop.sentry.dev/sdk/foundations/envelopes/event-payloads.md). Any fields/interfaces defined here can be passed along with your event. It's best to fill in as many of these as makes sense for your issue type.

There's a minimum set of fields which should be included:

* `event_id`: str
  * A UUID in string format that uniquely identifies the event. It must match the `event_id` of the occurrence if one is provided.
* `level`: str
  * The severity level of the event.
* `platform`: str
  * The platform the event came from, such as `python` or `javascript`.
* `project_id`: int
  * Id of the project the event belongs to. It must match the `project_id` of the occurrence.
* `tags`: object
  * Should be an empty dict if no tags.
* `timestamp`: str
  * An ISO 8601 date-time string for when the event occurred.

Caveats

* Attachments are not supported.

### [Status Change Schema](https://develop.sentry.dev/backend/issue-platform/producing-occurrences.md#status-change-schema)

If `payload_type` is set to `STATUS_CHANGE`, providing a `StatusChangeMessage` will update the status of an issue.

The `StatusChangeMessage` schema is as follows:

* `fingerprint`: str
  * Unique identifier for the occurrence.

* `project_id`: int
  * Id of the project this occurred in.

* `new_status`: int

  * Uses [GroupStatus](https://develop.sentry.dev/backend/issue-platform/producing-occurrences.md) enum. We currently support the following:

    * `UNRESOLVED`
    * `RESOLVED`
    * `IGNORED`

* `new_substatus`: int | None
  * Uses [GroupSubStatus](https://develop.sentry.dev/backend/issue-platform/producing-occurrences.md) enum. We do not support the `NEW` substatus.

When providing the `new_status` and `new_substatus`, refer to the supported issue states and transitions [here](https://develop.sentry.dev/backend/issue-platform/producing-occurrences.md).

---

Find other pages: [Sitemap](https://develop.sentry.dev/sitemap.md) lists every page with a one-line summary, and [llms.txt](https://develop.sentry.dev/llms.txt) gives an overview with guidance for agents.
