{"id":30048537,"url":"https://github.com/bugsnag/bugsnag-api-ruby","last_synced_at":"2025-08-07T10:37:54.134Z","repository":{"id":20034377,"uuid":"23302485","full_name":"bugsnag/bugsnag-api-ruby","owner":"bugsnag","description":"BugSnag API toolkit for Ruby","archived":false,"fork":false,"pushed_at":"2025-01-27T15:03:58.000Z","size":307,"stargazers_count":22,"open_issues_count":4,"forks_count":15,"subscribers_count":31,"default_branch":"master","last_synced_at":"2025-07-27T11:58:51.370Z","etag":null,"topics":["bugsnag","platforms"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"jbossdemocentral/continuous-delivery-demo-app","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bugsnag.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":".github/support.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-08-25T05:03:12.000Z","updated_at":"2025-01-27T15:03:09.000Z","dependencies_parsed_at":"2025-01-14T09:38:35.524Z","dependency_job_id":"ec359974-cdbf-46eb-be99-da2185867eea","html_url":"https://github.com/bugsnag/bugsnag-api-ruby","commit_stats":{"total_commits":100,"total_committers":19,"mean_commits":"5.2631578947368425","dds":0.5700000000000001,"last_synced_commit":"e16dc04c6552f71bee5107d64629a8970d389aab"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/bugsnag/bugsnag-api-ruby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugsnag%2Fbugsnag-api-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugsnag%2Fbugsnag-api-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugsnag%2Fbugsnag-api-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugsnag%2Fbugsnag-api-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bugsnag","download_url":"https://codeload.github.com/bugsnag/bugsnag-api-ruby/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugsnag%2Fbugsnag-api-ruby/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268199620,"owners_count":24211823,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bugsnag","platforms"],"created_at":"2025-08-07T10:37:53.408Z","updated_at":"2025-08-07T10:37:54.119Z","avatar_url":"https://github.com/bugsnag.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"Bugsnag API Toolkit for Ruby\n============================\n\nThe library allows for quick read/write access to the [Bugsnag Data Access API](https://docs.bugsnag.com/api/data-access/) from your Ruby applications. You can use this library to build your own applications which leverage data found in your Bugsnag dashboard.\n\nVersion 3.x (current) and 2.x of this gem corresponds to v2 of the Data Access API, while [1.x](https://github.com/bugsnag/bugsnag-api-ruby/tree/v1.0.3) uses the (deprecated) v1 of the Data Access API.\n\nIf you are looking to automatically detect crashes in your Ruby apps, you should take a look at the [Bugsnag Ruby Detection Library](https://docs.bugsnag.com/platforms/ruby) instead.\n\nThis library borrows heavily from the code and philosophies of the fantastic [Octokit](https://github.com/octokit/octokit.rb) library. A big thanks to [@pengwynn](https://github.com/pengwynn) and the rest of the Octokit team!\n\n\n## Contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n  - [Making Requests](#making-requests)\n  - [Consuming Resources](#consuming-resources)\n  - [Accessing Related Resources](#accessing-related-resources)\n  - [Authentication](#authentication)\n  - [Pagination](#pagination)\n  - [Filtering](#filtering)\n  - [Accessing HTTP responses](#accessing-http-responses)\n- [API Methods](#api-methods)\n  - [Organizations](#organizations)\n  - [Collaborators](#collaborators)\n  - [Comments](#comments)\n  - [Errors](#errors)\n  - [Events](#events)\n  - [Event Fields](#event-fields)\n  - [Pivots](#pivots)\n  - [Projects](#projects)\n  - [Trends](#trends)\n  - [Stability](#stability)\n  - [Releases](#releases)\n- [Advanced Configuration](#advanced-configuration)\n\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem \"bugsnag-api\"\n```\n\nAnd then execute:\n\n```\n$ bundle\n```\n\nOr install it yourself as:\n\n```\n$ gem install bugsnag-api\n```\n\n\n## Usage\n\n### Require gem\n\n```ruby\nrequire 'bugsnag/api'\n```\n\n### Making Requests\n\nAPI methods are available as module methods or as client instance methods.\n\n```ruby\n# Provide authentication credentials\nBugsnag::Api.configure do |config|\n  config.auth_token = \"your-personal-auth-token\"\nend\n\n# Access API methods\norganizations = Bugsnag::Api.organizations\n```\n\nor...\n\n```ruby\n# Create an non-static API client\nclient = Bugsnag::Api::Client.new(auth_token: \"your-personal-auth-token\")\n\n# Access API methods on the client\norganizations = client.organizations\n```\n\n### Consuming Resources\n\nMost methods return a [`Resource`](http://www.rubydoc.info/gems/sawyer/Sawyer/Resource)\nobject which provides dot notation and [] access for fields returned in the API\nresponse.\n\n```ruby\n# Fetch an organization\norg = Bugsnag::Api.organization(\"organization-id\")\n\nputs org.name\n# =\u003e \"Acme Co\"\n\nputs org.fields\n# =\u003e #\u003cSet: {:id, :name, :slug, :creator, :created_at, :updated_at, :auto_upgrade, :upgrade_url, :billing_emails}\u003e\n\nputs org.id\n# =\u003e \"50baed0d9bf39c1431000003\"\n\naccount.rels[:upgrade].href\n# =\u003e \"https://api.bugsnag.com/organizations/50baed0d9bf39c1431000003/...\"\n```\n\n### Accessing Related Resources\n\nResources returned by Bugsnag API methods contain not only data but hypermedia link relations:\n\n```ruby\nproject = Bugsnag::Api.projects(\"organization-id\").first\n\n# Get the users rel, returned from the API as users_url in the resource\nproject.rels[:errors].href\n# =\u003e \"https://api.bugsnag.com/projects/50baed0d9bf39c1431000003/errors\"\n\nerrors = project.rels[:errors].get.data\nerrors.first.message\n# =\u003e \"Can't find method: getStrng()\"\n```\n\nWhen processing API responses, all `*_url` attributes are culled in to the link relations collection. Any `url` attribute becomes `.rels[:self]`.\n\n\n### Authentication\n\nAPI usage requires authentication. You can authenticate using either your\nBugsnag account's [auth token](https://app.bugsnag.com/settings/my-account/)\nor with your Bugsnag user credentials.\n\n```ruby\n# Authenticate with your Bugsnag account's auth token\nBugsnag::Api.configure do |config|\n  config.auth_token = \"your-personal-auth-token\"\nend\n\n# Authenticate using your Bugsnag email address and password. Unavailable when\n# using multi-factor authentication.\nBugsnag::Api.configure do |config|\n  config.email = \"example@example.com\"\n  config.password = \"password\"\nend\n```\n\n### Pagination\n\nMany Bugsnag API resources are paginated. While you may be tempted to start adding :page parameters to your calls, the API returns links to the next and previous pages for you in the `Link` response header, which we expose in `rels`:\n\n```ruby\nerrors = Bugsnag::Api.errors(\"project-id\", per_page: 100)\nlast_response = Bugsnag::Api.last_response\nuntil last_response.rels[:next].nil?\n  last_response = last_response.rels[:next].get\n  errors.concat last_response.data\nend\n```\n\n### Filtering\n\nEvents and Errors can be filtered to return a subset of data. Any of the filters usable in the Bugsnag dashboard can be used in this API. The filter object is a hash of Event Field keys containing an array of filter values. Each filter value has a `type` and a `value` to filter on. The type determines the type of comparison that will be performed.\n\n| `type` | Description | Multiple value combination logic |\n|-|-|-|\n| `eq` | Filter for items that 'match' the value. Some fields require an exact match and some support substring matching. | OR |\n| `ne` | Filter for items that don't match the value. | AND |\n\n:warning: Note that the Event Field `search` can not be used more than once in a call.\n\nYou can see the filterable fields for a project using the following snippet, after setting the `project-id` value.\n\n```ruby\nfields = Bugsnag::Api.event_fields(\"project-id\")\n\nputs \"List of the searchable fields for this project:\"\nfields.each_with_index do |field,idx|\n  puts \"  [#{idx}] #{field.display_id}\"\nend\n# =\u003e List of the searchable fields for this project:\n# =\u003e   [0] event\n# =\u003e   [1] error\n# =\u003e   [2] search\n# =\u003e   [3] user.id\n# =\u003e ...\n```\n\n### Accessing HTTP responses\n\nWhile most methods return a `Resource` object or a `Boolean`, sometimes you may need access to the raw HTTP response headers. You can access the last HTTP response with `Client#last_response`:\n\n```ruby\norganization = Bugsnag::Api.organizations.first\nresponse = Bugsnag::Api.last_response\nstatus = response.headers[:status]\n```\n\n## API Methods\n\nThe following methods are available via `Bugsnag::Api` and the Client interface.\nFor more information, consult the [API\ndocumentation](http://www.rubydoc.info/gems/bugsnag-api/Bugsnag/Api/Client)\n\n### Organizations\n\n```ruby\n# List your organizations\norgs = Bugsnag::Api.organizations\n\n# Get a single organization\norg = Bugsnag::Api.organization(\"organization-id\")\n```\n\n### Collaborators\n\n```ruby\n# List organization collaborators\nusers = Bugsnag::Api.collaborators(\"organization-id\")\n\n# List project collaborators\nusers = Bugsnag::Api.collaborators(nil, \"project-id\")\n\n# Invite a user to an account\nuser = Bugsnag::Api.invite_collaborators(\"org-id\", \"example@example.com\", {\n  admin: true\n})\n\n# Update a user's account permissions\nuser = Bugsnag::Api.update_collaborator_permissions(\"org-id\", \"user-id\", {\n  admin: false\n})\n\n# Remove a user from an account\nBugsnag::Api.delete_collaborator(\"org-id\", \"user-id\")\n```\n\n\n### Comments\n\n```ruby\n# List error comments\ncomments = Bugsnag::Api.comments(\"project-id\", \"error-id\")\n\n# Get a single comment\ncomment = Bugsnag::Api.comment(\"project-id\", \"comment-id\")\n\n# Create a comment\ncomment = Bugsnag::Api.create_comment(\"project-id\", \"error-id\", \"comment message\")\n\n# Update a comment\ncomment = Bugsnag::Api.update_comment(\"comment-id\", \"new comment message\")\n\n# Delete a comment\nBugsnag::Api.delete_comment(\"comment-id\")\n```\n\n### Errors\n\n```ruby\n# List project errors\nerrors = Bugsnag::Api.errors(\"project-id\", nil)\n\n# List errors with a filter (see Filtering section for more information)\n# Returns errors that match `EXC_BAD_INSTRUCTION`, this could be from the error class, message, context, or stack trace.\nerrors = Bugsnag::Api.errors(\"project-id\", nil, direction:\"desc\", filters: {\n  \"search\": [{ \"type\":\"eq\", \"value\":\"EXC_BAD_INSTRUCTION\" }]\n})\n\n# Get a single error\nerror = Bugsnag::Api.error(\"project-id\", \"error-id\")\n\n# Update a single error\nerror = Bugsnag::Api.update_errors(\"project-id\", \"error-id\")\n\n# Update bulk errors\nerror = Bugsnag::Api.update_errors(\"project-id\",\n                                   [\"error-id1\", \"error-id2\"])\n\n# Delete an error\nerror = Bugsnag::Api.delete_error(\"project-id\", \"error-id\")\n```\n\n### Events\n\n```ruby\n# List project events\nevents = Bugsnag::Api.events(\"project-id\")\n\n# List error events\nevents = Bugsnag::Api.error_events(\"project-id\", \"error-id\")\n\n# List events with a filter (see Filtering section for more information)\n# Returns events with\n#   class `EXC_BAD_INSTRUCTION` OR `EXC_BAD_ACCESS`\n#   AND where the device is jailbroken\nevents = Bugsnag::Api.events(PROJECT_ID, direction:\"desc\", filters: {\n  \"event.class\": [{ \"type\":\"eq\", \"value\":\"EXC_BAD_INSTRUCTION\" }, { \"type\":\"eq\", \"value\":\"EXC_BAD_ACCESS\"  }],\n  \"device.jailbroken\": [{ \"type\":\"eq\", \"value\":\"false\"}]\n})\n\n# Get the latest event\nevent = Bugsnag::Api.latest_event(\"project-id\", \"error-id\")\n\n# Get a single event\nevent = Bugsnag::Api.event(\"project-id\", \"event-id\")\n\n# Delete an event\nBugsnag::Api.delete_event(\"project-id\", \"event-id\")\n```\n\n### Event Fields\n\n```ruby\n# list a project's event fields\nBugsnag::Api.event_fields(\"project-id\")\n\n# create an event field\nBugsnag::Api.create_event_field(\"project-id\", \"display id\", \"path.to.field\", {})\n\n# update an event field\nBugsnag::Api.update_event_field(\"project-id\", \"display id\", \"new.path.to.field\")\n\n# delete an event field\nBugsnag::Api.delete_event_field(\"project-id\", \"display id\")\n```\n\n### Projects\n\n```ruby\n# List organization projects\nprojects = Bugsnag::Api.projects(\"organization-id\")\n\n# Get a single project\nproject = Bugsnag::Api.project(\"project-id\")\n\n# Create a project\nproject = Bugsnag::Api.create_project(\"organization-id\", \"project name\", \"rails\")\n\n# Update a project\nproject = Bugsnag::Api.update_project(\"project-id\", {\n  name: \"New Name\"\n})\n\n# Regenerate a project API key\nBugsnag::Api.regenerate_api_key(\"project-id\")\n\n# Delete a project\nBugsnag::Api.delete_project(\"project-id\")\n```\n\n### Pivots\n\n```ruby\n# list a project's pivots\nBugsnag::Api.pivots(\"project-id\")\n\n# list pivot values\nBugsnag::Api.pivot_values(\"project-id\", \"display id\")\n```\n\n### Trends\n\n```ruby\n# list an error's trends in 5 buckets\nBugsnag::Api.trends_buckets(\"project-id\", 5, \"error-id\")\n\n# list a project's trends by resolution\nBugsnag::Api.trends_resolution(\"project-id\", \"2h\")\n```\n\n### Stability\n\n```ruby\n# view a project's stability trend\nBugsnag::Api.stability_trend(\"project-id\")\n```\n\n### Releases\n\n```ruby\n# list the releases in a project\nBugsnag::Api.releases(\"project-id\")\n\n# view a single release\nBugsnag::Api.release(\"project-id\", \"release-id\")\n\n# list the releases in a release group\nBugsnag::Api.releases_in_group(\"release-group-id\")\n```\n\n## Advanced Configuration\n\n### Endpoint\n\nBy default, `https://api.bugsnag.com` is used for API access, if you are using\nBugsnag Enterprise, you can configure a custom endpoint.\n\n```ruby\nBugsnag::Api.configure do |config|\n  config.endpoint = \"http://api.bugsnag.example.com\"\nend\n```\n\n### Proxy\n\nIf you are using a proxy, you can configure the API client to use it.\n\n```ruby\nBugsnag::Api.configure do |config|\n  config.proxy = {\n    uri:        \"http://proxy.example.com\",\n    user:       \"foo\",\n    password:   \"bar\"\n  }\nend\n```\n\n\n## License\n\nThe Bugsnag API Toolkit for Ruby is free software released under the MIT License. See [LICENSE.txt](LICENSE.txt) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbugsnag%2Fbugsnag-api-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbugsnag%2Fbugsnag-api-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbugsnag%2Fbugsnag-api-ruby/lists"}