|
| 1 | +Sentry platform--- |
| 2 | +title: "Account Provisioning API" |
| 3 | +description: "Learn how to automatically provision Sentry organizations for your customers using our provisioning API." |
| 4 | +sidebar_order: 1 |
| 5 | +--- |
| 6 | + |
| 7 | +# Account Provisioning API |
| 8 | + |
| 9 | +The Sentry Provisioning API allows partner platforms to automatically create Sentry organizations for their customers. This enables seamless onboarding of your users to Sentry's error monitoring and performance insights. |
| 10 | + |
| 11 | +## Overview |
| 12 | + |
| 13 | +When you call the Sentry provisioning API on behalf of your customer for the first time, the customer receives: |
| 14 | + |
| 15 | +- **A Sentry Organization** with the same name as their organization on your platform |
| 16 | +- **A Default Team** for collaboration within the organization |
| 17 | +- **Organization Ownership** assigned to the provided email address |
| 18 | +- **Subscription Plan** based on your partnership agreement |
| 19 | +- **Pre-configured Projects** (optional) that you specify |
| 20 | +- **Integration Token** (optional) for managing the organization programmatically |
| 21 | + |
| 22 | +## API Endpoint |
| 23 | + |
| 24 | +``` |
| 25 | +POST https://sentry.io/remote/channel-provision/account/ |
| 26 | +``` |
| 27 | + |
| 28 | +## Authentication |
| 29 | + |
| 30 | +The API requires a custom `X-Request-Signature` header with a SHA256 HMAC signature. The signature is built using your `API_SECRET_KEY` and the request body. |
| 31 | + |
| 32 | +### Signature Generation |
| 33 | + |
| 34 | +```python |
| 35 | +import hmac |
| 36 | +import hashlib |
| 37 | +import json |
| 38 | + |
| 39 | +def generate_signature(data, secret_key): |
| 40 | + secret_key_bytes = secret_key.encode("utf-8") |
| 41 | + json_data = json.dumps(data) |
| 42 | + data_bytes = json_data.encode("utf-8") |
| 43 | + signature = hmac.new( |
| 44 | + key=secret_key_bytes, |
| 45 | + msg=data_bytes, |
| 46 | + digestmod=hashlib.sha256 |
| 47 | + ).hexdigest() |
| 48 | + return signature |
| 49 | +``` |
| 50 | + |
| 51 | +## Request Parameters |
| 52 | + |
| 53 | +| Parameter | Type | Required | Description | |
| 54 | +|-----------|------|----------|-------------| |
| 55 | +| `channel` | string | Yes | Your partner name (case insensitive) | |
| 56 | +| `email` | string | Yes | Customer's email address (becomes org owner) | |
| 57 | +| `organizationName` | string | Yes | Customer's organization name (max 50 chars) | |
| 58 | +| `organizationID` | string | Yes | Unique ID for customer's organization on your platform | |
| 59 | +| `hasAgreedTerms` | boolean | Yes | Customer's agreement to Sentry terms | |
| 60 | +| `timestamp` | integer | Yes | Current timestamp for request expiration | |
| 61 | +| `url` | string | Yes | Must be `https://sentry.io/remote/channel-provision/account/` | |
| 62 | +| `projects` | array | No | List of projects to create | |
| 63 | +| `region` | string | No | Data residency (`us` or `de`, default: `us`) | |
| 64 | +| `isTest` | boolean | No | Set to `true` for testing (default: `false`) | |
| 65 | + |
| 66 | +### Project Object Structure |
| 67 | + |
| 68 | +```json |
| 69 | +{ |
| 70 | + "name": "project-name", |
| 71 | + "platform": "java" |
| 72 | +} |
| 73 | +``` |
| 74 | + |
| 75 | +### Supported Platforms |
| 76 | + |
| 77 | +The `platform` field supports all [Sentry platform identifiers](/platforms/), including: |
| 78 | +- `javascript`, `python`, `java`, `csharp`, `php`, `ruby`, `go`, `rust`, `swift`, `kotlin`, `dart`, and more |
| 79 | + |
| 80 | +## Example Request |
| 81 | + |
| 82 | +```python |
| 83 | +import requests |
| 84 | +import json |
| 85 | +import time |
| 86 | + |
| 87 | +URL = "https://sentry.io/remote/channel-provision/account/" |
| 88 | +API_SECRET_KEY = "your-partner-specific-secret-key" |
| 89 | + |
| 90 | +DATA = { |
| 91 | + "channel": "Your Platform Name", |
| 92 | + "organizationName": "Customer Corp", |
| 93 | + "organizationID": "unique-customer-id", |
| 94 | + |
| 95 | + "projects": [ |
| 96 | + {"name": "web-app", "platform": "javascript"}, |
| 97 | + {"name": "api-service", "platform": "python"} |
| 98 | + ], |
| 99 | + "hasAgreedTerms": True, |
| 100 | + "timestamp": int(time.time()), |
| 101 | + "url": URL, |
| 102 | + "isTest": False |
| 103 | +} |
| 104 | + |
| 105 | +# Generate signature |
| 106 | +signature = generate_signature(DATA, API_SECRET_KEY) |
| 107 | + |
| 108 | +# Make request |
| 109 | +response = requests.post( |
| 110 | + URL, |
| 111 | + data=json.dumps(DATA), |
| 112 | + headers={"X-Request-Signature": signature} |
| 113 | +) |
| 114 | + |
| 115 | +print(response.json()) |
| 116 | +``` |
| 117 | + |
| 118 | +## Response |
| 119 | + |
| 120 | +### Success (200) |
| 121 | + |
| 122 | +```json |
| 123 | +{ |
| 124 | + |
| 125 | + "organization": { |
| 126 | + "id": "123", |
| 127 | + "slug": "customer-corp", |
| 128 | + "name": "Customer Corp" |
| 129 | + }, |
| 130 | + "projects": [ |
| 131 | + { |
| 132 | + "dsn": "https://[email protected]/123", |
| 133 | + "project": { |
| 134 | + "id": "456", |
| 135 | + "slug": "web-app", |
| 136 | + "name": "web-app", |
| 137 | + "platform": "javascript" |
| 138 | + } |
| 139 | + } |
| 140 | + ], |
| 141 | + "integration_api_token": "your-integration-token" |
| 142 | +} |
| 143 | +``` |
| 144 | + |
| 145 | +### Error Responses |
| 146 | + |
| 147 | +- **400 Bad Request**: Invalid parameters (check response body for details) |
| 148 | +- **401 Unauthorized**: Invalid signature (check your API_SECRET_KEY) |
| 149 | +- **500 Server Error**: Internal server error (check response body for details) |
| 150 | + |
| 151 | +## Additional Operations |
| 152 | + |
| 153 | +### Adding Projects |
| 154 | + |
| 155 | +Call the API again with new projects to add them to an existing organization: |
| 156 | + |
| 157 | +```python |
| 158 | +DATA = { |
| 159 | + # ... existing parameters ... |
| 160 | + "projects": [ |
| 161 | + {"name": "new-service", "platform": "go"} |
| 162 | + ] |
| 163 | +} |
| 164 | +``` |
| 165 | + |
| 166 | +### Adding Managers |
| 167 | + |
| 168 | +Add additional users as managers to the organization: |
| 169 | + |
| 170 | +```python |
| 171 | +DATA = { |
| 172 | + # ... existing parameters ... |
| 173 | + "email": "[email protected]" # New manager email |
| 174 | +} |
| 175 | +``` |
| 176 | + |
| 177 | +## Customer Experience |
| 178 | + |
| 179 | +### Welcome Email |
| 180 | + |
| 181 | +When you provision an organization, the customer receives: |
| 182 | +- A welcome email with organization details |
| 183 | +- Instructions for managing their Sentry organization |
| 184 | +- Information about your partnership integration |
| 185 | +- Support contact information |
| 186 | + |
| 187 | +### Partner-Specific Features |
| 188 | + |
| 189 | +Based on your partnership agreement, you can enable: |
| 190 | + |
| 191 | +- **Partner Presence**: Show your platform as an organization member |
| 192 | +- **Persistent Plan**: Allow customers to upgrade plans independently |
| 193 | +- **Quota Visibility**: Control visibility of usage quotas |
| 194 | + |
| 195 | +## Integration Token |
| 196 | + |
| 197 | +The response includes an `integration_api_token` that allows you to: |
| 198 | +- Create and manage projects |
| 199 | +- Manage organization members |
| 200 | +- Access Sentry APIs on behalf of the customer |
| 201 | + |
| 202 | +Token permissions are defined in your partnership agreement. |
| 203 | + |
| 204 | +## Best Practices |
| 205 | + |
| 206 | +1. **Store organization mappings**: Keep track of the relationship between your customer IDs and Sentry organization IDs |
| 207 | +2. **Handle errors gracefully**: Implement proper error handling for failed provisioning |
| 208 | +3. **Use test mode**: Set `isTest: true` during development and testing |
| 209 | +4. **Respect rate limits**: Implement appropriate delays between requests |
| 210 | +5. **Secure your secret key**: Store your API_SECRET_KEY securely and never expose it in client-side code |
| 211 | + |
| 212 | +## Support |
| 213 | + |
| 214 | +For questions about the provisioning API or partnership integration, contact: |
| 215 | + |
0 commit comments