We're introducing a new, versioned Sourcegraph API for custom integrations, starting with the general availability of the Deep Search API. The new Deep Search API can be used to bring Deep Search to your own tooling.
The new, interactive API reference page is available at /api-reference (e.g. https://sourcegraph.example.com/api-reference). From this page, you can view the available operations and download the OpenAPI schema. We've seen many of you build on top of Sourcegraph as the central platform for access to code and code knowledge, to power your custom tooling.
We are committed to supporting integrations built on top of these new APIs with backwards compatibility and migration assistance for breaking changes.
The new Sourcegraph API is a work in progress, and capabilities are gradually being ported over. In the coming weeks, we will be bringing the following capabilities to the new API:
If you have an integration you'd like to build that is not currently served by the new Sourcegraph API, or if you need assistance with migration, please reach out at support@sourcegraph.com.
Existing APIs are not going away yet
The existing Sourcegraph GraphQL API and experimental /.api/deepsearch/ API remains available, but we recommend migrating to the new Sourcegraph API for a stable integration experience. To reflect the GraphQL API's intended purpose for integrators, we've renamed it in our documentation and UI to the "Debug API" or "Debug console".
Please reach out to support@sourcegraph.com to get the capabilities your require added to the new Sourcegraph API endpoints at /api/ for your use cases. We are fully committed to supporting our integrators!
Why we are building a new API
In the past, we've primarily directed integrators to the Sourcegraph GraphQL API. This is the same API we use to build Sourcegraph itself, which has its benefits: all capabilities you can see in our product, are immediately available via the GraphQL API. It also has a lot of issues, such as:
- As we redesign the product and adjust our features, it's very hard to maintain backwards compatibility within GraphQL, leading to a poor customer experience.
- Because our internal APIs have to support the advanced capabilities required in the product, integrators have to interrogate a very large and disorganized API surface to find what they need. Even then, it can be easy to misunderstand the intended use case of a particular part of the API.
- Our internal APIs are often designed with internal consumers in mind, rather than what makes the most sense for integrators, and to move fast, we don't apply the design rigour worthy of a first-class integrations API.
- GraphQL makes it difficult to apply reasonable rate limits, which is especially problematic with features operating over the massive codebases our customers have.
With Sourcegraph 7.0, we want to take this opportunity to start afresh: a new foundation for a first-class integrations API. This will allow us to provide a better integrations experience for our customers, treated like a core part of our product offering, with the level of care and attention it deserves.
If you'd like to partner with us to ensure the new Sourcegraph API suits your needs, please reach out to support@sourcegraph.com.