Getting Started
The Rollbar API provides a RESTful interface to much of the data in the
system. It is used by our official libraries to report exceptions,
deploys, and other messages. It can be used to create notifiers for
additional languages, get data out to integrate with other systems, or
whatever else you can imagine. If the API is missing something you'd
like to see, please let us know.
At this time the best way to discover the available resources/calls is
by exploring the test console.
Ping
To test whether you're able to ping the API server, you can simply run the following command:
curl 'https://api.rollbar.com/api/1/status/ping'
You will get back pong from our server if your request was successful.
Timestamps
All timestamps (inputs and outputs) are GMT unix timestamps.
Authentication
Authentication is done via access token included as a parameter. For GET, PUT, PATCH, and DELETE requests, it should be included as a query parameter. For POST requests, it should be included in the form data.
curl 'https://api.rollbar.com/api/1/item/12345?access_token=YOUR_ACCESS_TOKEN'
Project access tokens
Many operations require a project-specific access token. You can find and administer your
access tokens in Settings -> Project Access Tokens. Access tokens can have any or
all of the following scopes:
| Scope | Description |
|---|---|
post_server_item |
Can perform all POST requests to /deploy/ and /item/ |
post_client_item |
Can perform POST requests to /deploy/ and /item/, but only if the item has a client-side (browser, mobile) platform. |
read |
Can perform all GET requests |
write |
Can perform PATCH and DELETE requests. |
New projects are created with four tokens, one with each scope. As client tokens often need to be embedded in publicly-visible code (i.e the HTML source of a page), we recommend keeping this setup with an isolated post_client_item-only token.
Account Access Tokens
Operations performed at the level of the account require an account-specific access token. These can be found and managed at {Account name} Settings -> Account Access Tokens. Account access tokens can have the following scopes:
| Scope | Description |
|---|---|
read |
Supports all GET operations at the account level. |
write |
Supports all POST, PUT, PATCH, and DELETE operations at the account level. |
HTTP responses
The API can return the following HTTP response codes:
| Code | Type | Description |
|---|---|---|
200 |
OK |
Operation was completed successfully |
400 |
Bad request |
The request was malformed and could not be parsed. |
403 |
Access denied |
Access token was missing, invalid, or does not have the necessary permissions. |
404 |
Not found |
The requested resource was not found. This response will be returned if the URL is entirely invalid (i.e. /asdf), or if it is a URL that could be valid but is referencing something that does not exist (i.e. /item/12345). |
413 |
Request entity too large |
The request exceeded the maximum size of 128KB. |
422 |
Unprocessable Entity |
The request was parseable (i.e. valid JSON), but some parameters were missing or otherwise invalid. |
429 |
Too Many Requests |
If rate limiting is enabled for your access token, this return code signifies that the rate limit has been reached and the item was not processed. |
Examples
| Link | Author | Language | Description |
|---|---|---|---|
| api-examples | Rollbar | Python | Examples using RQL, deploys, occurrences, and reports |
| api-people-example | Rollbar | Python | Shows how to gather the Person data for each occurrence of a list of items |
| rolltools | Jonathan Slate | Ruby | A few utilities using the Rollbar API |
Last updated: March 1st, 2018
Create item
Overview
Rollbar receives Occurrences (exceptions and messages) via a RESTful JSON API. Clients send
JSON data via an HTTP POST to https://api.rollbar.com/api/1/item/
We strongly recommend using HTTPS, but HTTP is also supported. For HTTP,
use http://api.rollbar.com/api/1/item/
POSTed JSON data is accepted either as the body of the request, or form-encoded as the value of
the payload parameter (which should be the only parameter).
All responses (including error responses) are returned as JSON.
The example JSON payload below describes all the required and optional params that Rollbar understands. The meaning of each key is explained in the comments.
{
// Required: access_token
// An access token with scope "post_server_item" or "post_client_item".
// A post_client_item token must be used if the "platform" is "browser", "android", "ios", "flash", or "client"
// A post_server_item token should be used for other platforms.
"access_token": "aaaabbbbccccddddeeeeffff00001111",
// Required: data
"data": {
// Required: environment
// The name of the environment in which this occurrence was seen.
// A string up to 255 characters. For best results, use "production" or "prod" for your
// production environment.
// You don't need to configure anything in the Rollbar UI for new environment names;
// we'll detect them automatically.
"environment": "production",
// Required: body
// The main data being sent. It can either be a message, an exception, or a crash report.
"body": {
// Required: "trace", "trace_chain", "message", or "crash_report" (exactly one)
// If this payload is a single exception, use "trace"
// If a chain of exceptions (for languages that support inner exceptions), use "trace_chain"
// If a message with no stack trace, use "message"
// If an iOS crash report, use "crash_report"
// Optional: "telemetry". Only applicable if you are sending telemetry data.
"telemetry": {
// Required: level
// The severity level of the telemetry data. One of: "critical", "error", "warning", "info", "debug".
"level": "info",
// Required: type
// The type of telemetry data. One of: "log", "network", "dom", "navigation", "error", "manual".
"type": "network",
// Required: source
// The source of the telemetry data. Usually "client" or "server".
"source": "client",
// Required: timestamp_ms
// When this occurred, as a unix timestamp in milliseconds.
"timestamp_ms": 1500413393557,
// Required: body
// The key-value pairs for the telemetry data point. See "body" key below.
// If type above is "log", body should contain "message" key.
// If type above is "network", body should contain "method", "url", and "status_code" keys.
// If type above is "dom", body should contain "element" key.
// If type above is "navigation", body should contain "from" and "to" keys.
// If type above is "error", body should contain "message" key.
"body": {
"subtype": "xhr",
"method": "GET",
"url": "/api/1/item/4/",
"status_code": "200",
"start_timestamp_ms": 1500413394557,
"end_timestamp_ms": 1500413394957
},
},
// Option 1: "trace"
"trace": {
// Required: frames
// A list of stack frames, ordered such that the most recent call is last in the list.
"frames": [
// Each frame is an object.
{
// Required: filename
// The filename including its full path.
"filename": "/Users/brian/www/mox/mox/views/project.py",
// Optional: lineno
// The line number as an integer
"lineno": 26,
// Optional: colno
// The column number as an integer
"colno": 8,
// Optional: method
// The method or function name
"method": "index",
// Optional: code
// The line of code
"code": "_save_last_project(request, project_id, force=True)",
// Optional: class_name
// A string containing the class name.
// Used in the UI when the payload's top-level "language" key has the value "java"
"class_name": "java.lang.String",
// Optional: context
// Additional code before and after the "code" line
"context": {
// Optional: pre
// List of lines of code before the "code" line
"pre": [
"project = request.context",
"project_id = project.id"
],
// Optional: post
// List of lines of code after the "code" line
"post": []
},
// (Deprecated) Optional: args
// List of values of positional arguments to the method/function call
// NOTE: as this can contain sensitive data, you may want to scrub the values
"args": ["<Request object>", 25],
// (Deprecated) Optional: kwargs
// Object of keyword arguments (name => value) to the method/function call
// NOTE: as this can contain sensitive data, you may want to scrub the values
"kwargs": {
"force": true
},
// Optional: argspec
// List of the names of the arguments to the method/function call.
"argspec": ["request", "user"],
// Optional: varargspec
// If the function call takes an arbitrary number of unnamed positional arguments,
// the name of the argument that is the list containing those arguments.
// For example, in Python, this would typically be "args" when "*args" is used.
// The actual list will be found in locals.
"varargspec": "args",
// Optional: keywordspec
// If the function call takes an arbitrary number of keyword arguments, the name
// of the argument that is the object containing those arguments.
// For example, in Python, this would typically be "kwargs" when "**kwargs" is used.
// The actual object will be found in locals.
"keywordspec": "kwargs",
// Optional: locals
// Object of local variables for the method/function call.
// The values of variables from argspec, vararspec and keywordspec
// can be found in locals.
"locals": {
"request": "<Request object>",
"user": "<User object>",
"args": [true, "Python"],
"kwargs": {"level": "warning"}
}
},
{
"filename": "/Users/brian/www/mox/mox/views/project.py",
"lineno": 497,
"method": "_save_last_project",
"code": "user = foo"
}
],
// Required: exception
// An object describing the exception instance.
"exception": {
// Required: class
// The exception class name.
"class": "NameError",
// Optional: message
// The exception message, as a string
"message": "global name 'foo' is not defined",
// Optional: description
// An alternate human-readable string describing the exception
// Usually the original exception message will have been machine-generated;
// you can use this to send something custom
"description": "Something went wrong while trying to save the user object"
}
},
// Option 2: "trace_chain"
// Used for exceptions with inner exceptions or causes
"trace_chain": [
// Each element in the list should be a "trace" object, as shown above
// Must contain at least one element.
],
// Option 3: "message"
// Only one of "trace", "trace_chain", "message", or "crash_report" should be present.
// Presence of a "message" key means that this payload is a log message.
"message": {
// Required: body
// The primary message text, as a string
"body": "Request over threshold of 10 seconds",
// Can also contain any arbitrary keys of metadata. Their values can be any valid JSON.
// For example:
"route": "home#index",
"time_elapsed": 15.23
},
// Option 4: "crash_report"
// Only one of "trace", "trace_chain", "message", or "crash_report" should be present.
"crash_report": {
// Required: raw
// The raw crash report, as a string
// Rollbar expects the format generated by rollbar-ios
"raw": "<crash report here>"
}
},
// Optional: level
// The severity level. One of: "critical", "error", "warning", "info", "debug"
// Defaults to "error" for exceptions and "info" for messages.
// The level of the *first* occurrence of an item is used as the item's level.
"level": "error",
// Optional: timestamp
// When this occurred, as a unix timestamp.
"timestamp": 1369188822,
// Optional: code_version
// A string, up to 40 characters, describing the version of the application code
// Rollbar understands these formats:
// - semantic version (i.e. "2.1.12")
// - integer (i.e. "45")
// - git SHA (i.e. "3da541559918a808c2402bba5012f6c60b27661c")
// If you have multiple code versions that are relevant, those can be sent inside "client" and "server"
// (see those sections below)
// For most cases, just send it here.
"code_version": "3da541559918a808c2402bba5012f6c60b27661c",
// Optional: platform
// The platform on which this occurred. Meaningful platform names:
// "browser", "android", "ios", "flash", "client", "heroku", "google-app-engine"
// If this is a client-side event, be sure to specify the platform and use a post_client_item access token.
"platform": "linux",
// Optional: language
// The name of the language your code is written in.
// This can affect the order of the frames in the stack trace. The following languages set the most
// recent call first - 'ruby', 'javascript', 'php', 'java', 'objective-c', 'lua'
// It will also change the way the individual frames are displayed, with what is most consistent with
// users of the language.
"language": "python",
// Optional: framework
// The name of the framework your code uses
"framework": "pyramid",
// Optional: context
// An identifier for which part of your application this event came from.
// Items can be searched by context (prefix search)
// For example, in a Rails app, this could be `controller#action`.
// In a single-page javascript app, it could be the name of the current screen or route.
"context": "project#index",
// Optional: request
// Data about the request this event occurred in.
"request": {
// Can contain any arbitrary keys. Rollbar understands the following:
// url: full URL where this event occurred
"url": "https://rollbar.com/project/1",
// method: the request method
"method": "GET",
// headers: object containing the request headers.
"headers": {
// Header names should be formatted like they are in HTTP.
"Accept": "text/html",
"Referer": "https://rollbar.com/"
},
// params: any routing parameters (i.e. for use with Rails Routes)
"params": {
"controller": "project",
"action": "index"
},
// GET: query string params
"GET": {},
// query_string: the raw query string
"query_string": "",
// POST: POST params
"POST": {},
// body: the raw POST body
"body": "",
// user_ip: the user's IP address as a string.
// Can also be the special value "$remote_ip", which will be replaced with the source IP of the API request.
// Will be indexed, as long as it is a valid IPv4 address.
"user_ip": "100.51.43.14"
},
// Optional: person
// The user affected by this event. Will be indexed by ID, username, and email.
// People are stored in Rollbar keyed by ID. If you send a multiple different usernames/emails for the
// same ID, the last received values will overwrite earlier ones.
"person": {
// Required: id
// A string up to 40 characters identifying this user in your system.
"id": "12345",
// Optional: username
// A string up to 255 characters
"username": "brianr",
// Optional: email
// A string up to 255 characters
"email": "[email protected]"
},
// Optional: server
// Data about the server related to this event.
"server": {
// Can contain any arbitrary keys. Rollbar understands the following:
// host: The server hostname. Will be indexed.
"host": "web4",
// root: Path to the application code root, not including the final slash.
// Used to collapse non-project code when displaying tracebacks.
"root": "/Users/brian/www/mox",
// branch: Name of the checked-out source control branch. Defaults to "master"
"branch": "master",
// Optional: code_version
// String describing the running code version on the server
// See note about "code_version" above
"code_version": "b6437f45b7bbbb15f5eddc2eace4c71a8625da8c",
// (Deprecated) sha: Git SHA of the running code revision. Use the full sha.
"sha": "b6437f45b7bbbb15f5eddc2eace4c71a8625da8c"
},
// Optional: client
// Data about the client device this event occurred on.
// As there can be multiple client environments for a given event (i.e. Flash running inside
// an HTML page), data should be namespaced by platform.
"client": {
// Can contain any arbitrary keys. Rollbar understands the following:
"javascript": {
// Optional: browser
// The user agent string
"browser": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3)",
// Optional: code_version
// String describing the running code version in javascript
// See note about "code_version" above
"code_version": "b6437f45b7bbbb15f5eddc2eace4c71a8625da8c",
// Optional: source_map_enabled
// Set to true to enable source map deobfuscation
// See the "Source Maps" guide for more details.
"source_map_enabled": false,
// Optional: guess_uncaught_frames
// Set to true to enable frame guessing
// See the "Source Maps" guide for more details.
"guess_uncaught_frames": false
}
},
// Optional: custom
// Any arbitrary metadata you want to send. "custom" itself should be an object.
"custom": {},
// Optional: fingerprint
// A string controlling how this occurrence should be grouped. Occurrences with the same
// fingerprint are grouped together. See the "Grouping" guide for more information.
// Should be a string up to 40 characters long; if longer than 40 characters, we'll use its SHA1 hash.
// If omitted, we'll determine this on the backend.
"fingerprint": "50a5ef9dbcf9d0e0af2d4e25338da0d430f20e52",
// Optional: title
// A string that will be used as the title of the Item occurrences will be grouped into.
// Max length 255 characters.
// If omitted, we'll determine this on the backend.
"title": "NameError when setting last project in views/project.py",
// Optional: uuid
// A string, up to 36 characters, that uniquely identifies this occurrence.
// While it can now be any latin1 string, this may change to be a 16 byte field in the future.
// We recommend using a UUID4 (16 random bytes).
// The UUID space is unique to each project, and can be used to look up an occurrence later.
// It is also used to detect duplicate requests. If you send the same UUID in two payloads, the second
// one will be discarded.
// While optional, it is recommended that all clients generate and provide this field
"uuid": "f81d4fae-7dec-11d0-a765-00a0c91e6bf6",
// Optional: notifier
// Describes the library used to send this event.
"notifier": {
// Optional: name
// Name of the library
"name": "pyrollbar",
// Optional: version
// Library version string
"version": "0.5.5"
}
}
}
Note that you can send us whatever data you want and we'll store it. Max payload size is 512kb. For best results, put custom data in request, server, client, person, or custom.
Get an item (by project counter)
counter must be an item counter for an item in the project. The counter can be found in URLs like https://rollbar.com/myaccount/myproject/items/456/ (456 is the counter).
The success response is a 301 redirect like this:
HTTP/1.1 301 Moved Permanently
Location: /api/1/item/272505123?access_token=abcd1234abcd1234abcd1234abcd1234
{
"err": 0,
"result": {
"itemId": 272505123,
"path": "/api/1/item/272505123",
"uri": "/api/1/item/272505123?access_token=abcd1234abcd1234abcd1234abcd1234"
}
}
Get an item (by ID)
itemid must be an item ID for an item in the project. These IDs are returned as the id field in other API calls.
Note that they are NOT found in in URLs like https://rollbar.com/myaccount/myproject/items/456/ – that is the "counter", which can be used in the following API call.
List all items
Examples
Get the 101st through 199th active items:
curl 'https://api.rollbar.com/api/1/items/?access_token=YOUR_READ_TOKEN&status=active&page=2'
Get the first page of items that are error or critical, in the production environment:
curl 'https://api.rollbar.com/api/1/items/?access_token=YOUR_READ_TOKEN&level=error&level=critical&environment=production'
Update an item
Used to modify an item's state. Currently supports:
- setting the status, level, title, assigned user
- when resolving, setting the "resolved in version"
Example -
curl -X PATCH 'https://api.rollbar.com/api/1/item/275123456?access_token=WRITE_ACCESS_TOKEN' \
--header "Content-Type: application/json" \
--data '{"status": "resolved", "resolved_in_version": "aabbcc1"}'
List all occurrences in an item
Returns all occurrences of an item, in pages of 20. Order is descending by occurrence ID (which is approximately descending by timestamp).
List all occurrences in a project
Returns all occurrences in the project, in pages of 20. Order is descending by occurrence ID (which is approximately descending by timestamp).
Get an occurrence
Returns a JSON object describing the occurrence. This is similar to the "Raw JSON" section of the occurrence detail page.
instance_id must be an Occurrence ID for an occurrence in the project. These IDs are returned as the id field in other occurrence API calls, and can be found in the Rollbar UI on URLs like https://rollbar.com/Rollbar/demo/items/54/occurrences/3209095494/ (3209095494 is the Occurrence ID).
Delete an occurrence
Permanently deletes an occurrence. This will make it unavailable in the Rollbar UI and API. Aggregate counts are not updated.
Report a deploy
For tool-specific instructions on reporting a deploy, see our Deploy Tracking docs.
List all deploys
Returns all deploys in the project, most recent first, in pages of 20.
Get a deploy
deploy_id must be an ID for a deploy in the project. These IDs are returned as the id field in other API calls, and can be found in the Rollbar UI on URLs like https://rollbar.com/deploy/12345/ (12345 is the Deploy ID).
Upload a JS source map
In the above example, our website is http://example.com, we have a minified JavaScript file at http://example.com/js/example.min.js, and we have a source tree like this:
example/
example/static/js/example.min.js
example/static/js/example.min.map
example/static/js/site.js
example/static/js/util.js
Upload an iOS dSym file
Note: For version, you should use the "Bundle version" from your plist which corresponds to the Build Number. This is not the Version Number which is found under the key "Bundle versions string, short" in your plist. See this technical note for more information. We use this to match up the dSYM with the same version of the code that caused the stack trace.
Create an RQL job
Response
The response will be a RQL Job resource, example:
{
"err" 0,
"result": {
"id": 123, // job id
"project_id": 456,
"query_string": "show tables",
"status": "new", // One of "new", "running", "success", "failed", "cancelled", or "timed_out"
"job_hash": "abcdefabcdefabcdef",
"date_created": 1446598885,
"date_modified": 1446598885
}
}
Check an RQL job
Response
The response will be a RQL Job resource, example:
{
"err" 0,
"result": {
"id": 123, // job id
"project_id": 456,
"query_string": "show tables",
"status": "new", // One of "new", "running", "success", "failed", "cancelled", or "timed_out"
"job_hash": "abcdefabcdefabcdef",
"date_created": 1446598885,
"date_modified": 1446598885,
"result": {} // A RQL job resource if expand=result is used in query string
}
}
Get RQL job results
Response
The response will be a RQL job result resource, example:
{
"err" 0,
"result": {
"job_id": 123, // job id
"result": {
"rows": [{}],
"selectionColumns": [],
"columns": [],
"errors": [],
"warnings": [],
"rowcount": 1,
"executionTime": 123
},
"job": {} // A RQL job resource if expand=job is set in the query string
}
}
Cancel an RQL job
Response
The response will be a RQL Job resource, example:
{
"err" 0,
"result": {
"id": 123, // job id
"project_id": 456,
"query_string": "show tables",
"status": "cancelled", // One of "new", "running", "success", "failed", "cancelled", or "timed_out"
"job_hash": "abcdefabcdefabcdef",
"date_created": 1446598885,
"date_modified": 1446598885
}
}
Get top active items
Response
{
"err": 0,
"result": [
// each element in the list is an object with an "item" object and a "counts" list
{
// data describing the item (similar to that returned by GET /api/1/item/:id)
"item": {
"id": 2071,
"counter": 1007,
"environment": "production",
"framework": 0,
"last_occurrence_timestamp": 1408410581,
"level": 40,
"occurrences": 54,
"project_id": 12345,
"title": "Something went wrong",
"unique_occurrences": 5
},
// list of occurrence counts in the past 24 hours. Oldest first.
"counts": [12, 10, 7, 3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 8, 5, 6]
},
{ /* more elements ... */ }
]
}
Get occurrence counts
Analogous to "Hourly Error/Critical Occurrences" and "Daily Error/Critical Occurrences" on the Dashboard.
Returns an array of recent counts as [timestamp, count] pairs, where each count is the number of matching occurrences in the time range [timestamp, timestamp + bucket_size - 1].
Timestamps are UNIX timestamps, in whole seconds.
Response
{
"err": 0,
"result": [
[
// timestamp
1408561200,
// count (number of occurrences from time 1408561200 until time 1408564799)
0
],
[
1408564800,
0
],
[
1408568400,
0
],
[
1408572000,
6
]
]
}
Get activated item counts
Analogous to "Daily New/Reactivated Items" graph on the Dashboard.
Returns an array of recent counts as [timestamp, count] pairs, where each count is the number of items that were first seen or reactivated in the time range [timestamp, timestamp + bucket_size - 1].
Timestamps are UNIX timestamps, in whole seconds.
Response
{
"err": 0,
"result": [
[
// timestamp
1408561200,
// count (number of occurrences from time 1408561200 until time 1408564799)
0
],
[
1408564800,
0
],
[
1408568400,
0
],
[
1408572000,
6
]
]
}
Create a team
List all users
List all users who are members of an account
Response Format
{
"err": 0,
"result": {
"users": [
{
"username": "brianr",
"id": 1,
"email": "[email protected]"
},
{
"username": "coryvirok",
"id": 2,
"email": "[email protected]"
}
]
}
}
Get a user
Get user details for a given account
Returns basic information about the user, as relevant to the account your access token is for. This is the same information available on the "Members" page in the Rollbar UI.
Sample Response
{
"err": 0,
"result": {
"id": 14,
"username": "brian",
"email": "[email protected]",
"email_enabled": 1
}
}
List a team's users
Example response:
{
"err": 0,
"result": {
"users": [
{
"username": "richard",
"id": 46457,
"email": "[email protected]"
},
{
"username": "gabe",
"id": 112303,
"email": "[email protected]"
}
]
}
}
Check if a user is assigned to a team
List a user's teams
Invite an email address to a team
Invites a user to the specific team, using the user's email address.
If the email address belongs to an existing Rollbar user, they will be immediately added to the team, and sent an email notification. Otherwise, an invite email will be sent, containing a signup link that will allow the recipient to join the specified team.
Example Response
{
"err": 0,
"result": {
"id": 71328,
"from_user_id": 5325,
"team_id": 272686,
"to_email": "[email protected]",
"status": "pending",
"date_created": 1519946545,
"date_redeemed": null
}
}
List invitations to a team
Returns all invites ever sent for the team–pending, accepted, rejected, and canceled.
Example response
{
"err": 0,
"result": [
{
"id": 71328,
"from_user_id": 5325,
"team_id": 272686,
"to_email": "[email protected]",
"status": "pending",
"date_created": 1519946545,
"date_redeemed": null
}
]
}
Get invitation
Example response
Example Response
{
"err": 0,
"result": {
"id": 71328,
"from_user_id": 5325,
"team_id": 272686,
"to_email": "[email protected]",
"status": "pending",
"date_created": 1519946545,
"date_redeemed": null
}
}
List a team's projects
Assign a team to a project
Check if a team is assigned to a project
List a user's projects
Request person deletion
This endpoint allows for removal of a tracked person from all projects within an account.
To identify the person, you must provide exactly one of the following:
emailusernameperson_id
These correspond to the values transmitted in the original occurrences (see the docs for Create item) and can also be found by viewing any tracked person via the People Tracking page in any project.
Requests for person deletion are asynchronous. The returned value will include an id property that can be used to check the status of the deletion process, e.g.
{
"err": 0,
"result": {
"id": 3
}
}
Get person deletion status
Check on the status of a person deletion request.
The response will include a status, e.g.
{
"err": 0,
"result": {
"state": "success", // possible values are "new","running","paused","success","cancelled","failed"
"id": 3
}
}