返回 Skill 列表
extension
分类: 安全与合规需要 API Key

Sentry

Sentry API 集成,托管身份验证,监控错误、问题及应用程序性能,用于列出问题、检索等场景。

person作者: byungkyuhubclawhub

Sentry

Access the Sentry API with managed authentication. Monitor errors, manage issues, projects, teams, and releases.

Quick Start

# List issues for a project
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.maton.ai/sentry/api/0/projects/{organization_slug}/{project_slug}/issues/')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Base URL

https://api.maton.ai/sentry/{native-api-path}

Maton proxies requests to {subdomain}.sentry.io and automatically injects your credentials.

Authentication

All requests require the Maton API key in the Authorization header:

Authorization: Bearer $MATON_API_KEY

Environment Variable: Set your API key as MATON_API_KEY:

export MATON_API_KEY="YOUR_API_KEY"

Getting Your API Key

  1. Sign in or create an account at maton.ai
  2. Go to maton.ai/settings
  3. Copy your API key

Connection Management

Manage your Sentry OAuth connections at https://api.maton.ai.

List Connections

python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.maton.ai/connections?app=sentry&status=ACTIVE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Create Connection

python <<'EOF'
import urllib.request, os, json
data = json.dumps({'app': 'sentry'}).encode()
req = urllib.request.Request('https://api.maton.ai/connections', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Get Connection

python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.maton.ai/connections/{connection_id}')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Response:

{
  "connection": {
    "connection_id": "{connection_id}",
    "status": "ACTIVE",
    "creation_time": "2025-12-08T07:20:53.488460Z",
    "last_updated_time": "2026-01-31T20:03:32.593153Z",
    "url": "https://connect.maton.ai/?session_token=...",
    "app": "sentry",
    "metadata": {}
  }
}

Open the returned url in a browser to complete OAuth authorization.

Delete Connection

python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.maton.ai/connections/{connection_id}', method='DELETE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Specifying Connection

If you have multiple Sentry connections, specify which one to use with the Maton-Connection header:

python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.maton.ai/sentry/api/0/organizations/')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Maton-Connection', '{connection_id}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

If you have multiple connections, always include this header to ensure requests go to the intended account.

Security & Permissions

  • Access is scoped to issues, events, projects, organizations, and error tracking within the connected Sentry account.
  • All write operations require explicit user approval. Before executing any create, update, or delete call, confirm the target resource and intended effect with the user.

API Reference

Organization Operations

List Organizations

GET /sentry/api/0/organizations/

Retrieve an Organization

GET /sentry/api/0/organizations/{organization_slug}/

Update an Organization

PUT /sentry/api/0/organizations/{organization_slug}/
Content-Type: application/json

{
  "name": "Updated Organization Name"
}

List Organization Projects

GET /sentry/api/0/organizations/{organization_slug}/projects/

List Organization Members

GET /sentry/api/0/organizations/{organization_slug}/members/

Project Operations

Retrieve a Project

GET /sentry/api/0/projects/{organization_slug}/{project_slug}/

Update a Project

PUT /sentry/api/0/projects/{organization_slug}/{project_slug}/
Content-Type: application/json

{
  "name": "Updated Project Name",
  "slug": "updated-project-slug"
}

Delete a Project

DELETE /sentry/api/0/projects/{organization_slug}/{project_slug}/

Create a New Project

POST /sentry/api/0/teams/{organization_slug}/{team_slug}/projects/
Content-Type: application/json

{
  "name": "New Project",
  "slug": "new-project"
}

Issue Operations

List Project Issues

GET /sentry/api/0/projects/{organization_slug}/{project_slug}/issues/

Query Parameters:

  • statsPeriod - Stats period: 24h, 14d, or empty
  • shortIdLookup - Enable short ID lookup (set to 1)
  • query - Sentry search query (default: is:unresolved)
  • cursor - Pagination cursor

List Organization Issues

GET /sentry/api/0/organizations/{organization_slug}/issues/

Retrieve an Issue

GET /sentry/api/0/issues/{issue_id}/

Update an Issue

PUT /sentry/api/0/issues/{issue_id}/
Content-Type: application/json

{
  "status": "resolved"
}

Status values: resolved, unresolved, ignored

Delete an Issue

DELETE /sentry/api/0/issues/{issue_id}/

List Issue Events

GET /sentry/api/0/issues/{issue_id}/events/

List Issue Hashes

GET /sentry/api/0/issues/{issue_id}/hashes/

Event Operations

List Project Events

GET /sentry/api/0/projects/{organization_slug}/{project_slug}/events/

Retrieve an Event

GET /sentry/api/0/projects/{organization_slug}/{project_slug}/events/{event_id}/

Team Operations

List Organization Teams

GET /sentry/api/0/organizations/{organization_slug}/teams/

Create a Team

POST /sentry/api/0/organizations/{organization_slug}/teams/
Content-Type: application/json

{
  "name": "New Team",
  "slug": "new-team"
}

Retrieve a Team

GET /sentry/api/0/teams/{organization_slug}/{team_slug}/

Update a Team

PUT /sentry/api/0/teams/{organization_slug}/{team_slug}/
Content-Type: application/json

{
  "name": "Updated Team Name"
}

Delete a Team

DELETE /sentry/api/0/teams/{organization_slug}/{team_slug}/

List Team Projects

GET /sentry/api/0/teams/{organization_slug}/{team_slug}/projects/

Release Operations

List Organization Releases

GET /sentry/api/0/organizations/{organization_slug}/releases/

Create a Release

POST /sentry/api/0/organizations/{organization_slug}/releases/
Content-Type: application/json

{
  "version": "1.0.0",
  "projects": ["project-slug"]
}

Retrieve a Release

GET /sentry/api/0/organizations/{organization_slug}/releases/{version}/

Update a Release

PUT /sentry/api/0/organizations/{organization_slug}/releases/{version}/
Content-Type: application/json

{
  "ref": "main",
  "commits": [
    {
      "id": "abc123",
      "message": "Fix bug"
    }
  ]
}

Delete a Release

DELETE /sentry/api/0/organizations/{organization_slug}/releases/{version}/

List Release Deploys

GET /sentry/api/0/organizations/{organization_slug}/releases/{version}/deploys/

Create a Deploy

POST /sentry/api/0/organizations/{organization_slug}/releases/{version}/deploys/
Content-Type: application/json

{
  "environment": "production"
}

Pagination

Sentry uses cursor-based pagination via the Link header.

GET /sentry/api/0/projects/{organization_slug}/{project_slug}/issues/?cursor=0:100:0

Response headers include pagination links:

Link: <...?cursor=0:0:1>; rel="previous"; results="false"; cursor="0:0:1",
      <...?cursor=0:100:0>; rel="next"; results="true"; cursor="0:100:0"
  • results="true" indicates more results exist
  • results="false" indicates no more results in that direction

Code Examples

JavaScript

const response = await fetch(
  'https://api.maton.ai/sentry/api/0/organizations/',
  {
    headers: {
      'Authorization': `Bearer ${process.env.MATON_API_KEY}`
    }
  }
);
const data = await response.json();

Python

import os
import requests

response = requests.get(
    'https://api.maton.ai/sentry/api/0/organizations/',
    headers={'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'}
)
data = response.json()

Python - Resolve an Issue

import os
import requests

response = requests.put(
    'https://api.maton.ai/sentry/api/0/issues/12345/',
    headers={
        'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}',
        'Content-Type': 'application/json'
    },
    json={'status': 'resolved'}
)

Notes

  • Sentry API uses version 0 prefix: /api/0/
  • Organization and project identifiers use slugs (lowercase, hyphenated)
  • Issue IDs are numeric
  • Release versions can contain special characters (URL encode as needed)
  • IMPORTANT: When using curl commands, use curl -g when URLs contain brackets to disable glob parsing
  • IMPORTANT: When piping curl output to jq or other commands, environment variables like $MATON_API_KEY may not expand correctly in some shell environments

Error Handling

| Status | Meaning | |--------|---------| | 400 | Missing Sentry connection | | 401 | Invalid or missing Maton API key | | 403 | Insufficient permissions (check OAuth scopes) | | 404 | Resource not found | | 429 | Rate limited | | 4xx/5xx | Passthrough error from Sentry API |

Resources