Skip to main content

Overview

This section describes how to use the Diversion API to build custom integrations and clients.

Authentication

Generate an API token from Settings > Integrations in the Diversion web app. Tokens start with dvk_, are shown only once, and can be revoked individually. See Generate an API Token for instructions. API access requires the Pro plan or above. All API endpoints, unless stated otherwise, are authenticated using Bearer tokens.

Base URL

All API endpoints are relative to the base URL https://api.diversion.dev/v0.

Making Your First Request

Once you have your token, you can test that it works by making a request to the /auth/test endpoint:

Real-World Example: Create a New Repo

See the endpoint’s full documentation here.

Error handling

Some common errors can be returned from most API endpoints and are listed below. Errors that are specific to an API endpoint are listed in the endpoint’s documentation.

Error format

All errors are returned in the following format:

Common errors

400 Bad Request

Returned when the request is invalid. Example response:

401 Unauthorized

Returned when the authentication token is invalid or expired. Example response:

403 Forbidden

Returned when the authentication token is valid but the user is not authorized to access the endpoint. Example response:

404 Not Found

Returned when the requested resource is not found. Example response:

500 Internal Server Error

Returned when the server encountered an unexpected condition that prevented it from fulfilling the request. Example response: