Store Endpoint

The store endpoint is used to send JSON event payloads to Sentry. It is located at:

Copied
POST /api/<project_id>/store/

Building the JSON Packet

The body of the post is a string representation of a JSON object. For example, with an included Exception event, a basic JSON body might resemble the following:

Copied
{
  "event_id": "fc6d8c0c43fc4630ad850ee518f1b9d0",
  "transaction": "my.module.function_name",
  "timestamp": "2011-05-02T17:41:36",
  "tags": {
    "ios_version": "4.0"
  },
  "exception": {"values":[{
    "type": "SyntaxError",
    "value": "Wattttt!",
    "module": "__builtins__"
  }]}
}

The body of the event can carry attributes or interface values. The difference between them is that attributes are very barebones key/value pairs (for the most part) and interfaces are rich styled interface elements. Examples of attribute are event_id or tags whereas the exception key is an interface.

For a list of all supported attributes and interfaces in event payloads, see Event Payloads.

HTTP Headers

The store endpoint supports only JSON payloads. While not enforced by the endpoint, we recommend submitting the valid MIME type for JSON payloads:

Copied
Content-Type: application/json

Request Compression

In addition to content-encoding supported by all ingestion endpoints, this endpoint accepts zlib compressed JSON in a base64 wrapper which is detected regardless of the header. This allows you to send compressed events in very restrictive environments. Do not set a content-encoding header in this case.

In pseudo code, this maps to:

Copied
compressed = base64_encode(zlib.compress(payload))

Size Limits

Event ingestion imposes limits on the size of a store request:

  • 200KB for a compressed store request
  • 1MB for a full event payload after decompression

A Working Example

To sum everything up, you should be sending an HTTP POST request to a Sentry webserver, where the path is the BASE_URI/api/PROJECT_ID/store/. Given the following DSN:

Copied
https://b70a31b3510c4cf793964a185cfe1fd0:b7d80b520139450f903720eb7991bf3d@sentry.example.com/1

The request body should resemble the following:

Copied
POST /api/1/store/ HTTP/1.1
User-Agent: sentry-python/1.0
Content-Type: application/json
X-Sentry-Auth: Sentry sentry_version=7,
  sentry_key=b70a31b3510c4cf793964a185cfe1fd0,
  sentry_secret=b7d80b520139450f903720eb7991bf3d,
  sentry_client=sentry-python/1.0

{
  "event_id": "fc6d8c0c43fc4630ad850ee518f1b9d0",
  "culprit": "my.module.function_name",
  "timestamp": "2011-05-02T17:41:36",
  "message": "SyntaxError: Wattttt!",
  "exception": {
    "values": [
      {
        "type": "SyntaxError",
        "value": "Wattttt!",
        "module": "__builtins__"
      }
    ]
  }
}

Creating Events from Sample Files

We have a number of sample payloads in the code base that are helpful when you want to simulate errors for different platforms but don't have an application in that platform available.

Copied
cd ~/code/sentry

# Given a DSN of http://3385d72507004b2b8129b2cb963d79b2@dev.getsentry.net:8000/1
export SENTRY_KEY="3385d72507004b2b8129b2cb963d79b2"

# Create a native event
curl -v -XPOST http://${SENTRY_KEY}@dev.getsentry.net:8000/api/1/store/ \
 -H 'Content-Type: application/json' \
 -H "X-Sentry-Auth: Sentry sentry_version=7,sentry_client=sentry-curl/1.0,sentry_key=${SENTRY_KEY}" \
 -d "$(cat src/sentry/data/samples/native.json)"

# Create a minidump event
curl -v -X POST "http://dev.getsentry.net:8000/api/1/minidump/?sentry_key=${SENTRY_KEY}" \
 -F upload_file_minidump=@tests/fixtures/native/windows.dmp \
 -F upload_file_makefile=@Makefile \
 -F upload_file_license=@LICENSE

# Create a python event
curl -v -XPOST http://${SENTRY_KEY}@dev.getsentry.net:8000/api/1/store/ \
 -H 'Content-Type: application/json' \
 -H "X-Sentry-Auth: Sentry sentry_version=7,sentry_client=sentry-curl/1.0,sentry_key=${SENTRY_KEY}" \
 -d "$(cat src/sentry/data/samples/python.json)"
You can edit this page on GitHub.