⏱ Estimated Time To Completion: 5 minutes

Please make sure you’ve installed Decipher for your frontend before continuing.

1

Install the SDK

Decipher uses the Sentry SDK to collect runtime data from your application. Installation is simple:

Bash
pip install --upgrade 'sentry-sdk[fastapi]'

The FastAPI integration will be automatically enabled when you initialize the Sentry SDK, provided the FastAPI package is included in your application’s dependencies.

2

Initialize the SDK

Initialize the SDK as soon as possible in your application’s runtime.

import sentry_sdk

sentry_sdk.init(
    dsn="YOUR_DECIPHER_DSN", # Get this at https://app.getdecipher.com/settings
    traces_sample_rate=1.0,
    profiles_sample_rate=1.0,
)

app = FastAPI(__name__) 
# ...

You can get the dsn parameter by creating a project within Decipher with your work email. On the Settings page, select a new project name and click ”Create New Project”. Decipher will generate a DSN to that you can paste.

3

Test the integration

Throw an error anywhere in your application and Decipher will automatically capture the exception and runtime alongside it.

For example:

from FastAPI import FastAPI

sentry_sdk.init(...)   # See above

app = FastAPI(__name__)

@app.route("/")
def hello_world():
    1 / 0  # raises an error
    return "<p>Hello, World!</p>"

Check out the Decipher dashboard to see information about your captured error. Decipher will automatically analyze and group your errors to highlight the important, high-impact ones.