Skip to content
This documentation applies to Codacy Self-hosted v3.5.1

For the latest updates and improvements, see the latest Cloud documentation instead.

Using the Codacy API

The Codacy API allows you to programmatically retrieve and analyze data from Codacy and perform a few configuration changes.

Codacy supports two API versions but prefer the new API v3 when possible since it's the version being actively developed:

API v3 (preferred) API v2
Endpoint documentation https://api.codacy.com/api/api-docs https://api.codacy.com/swagger
Base URL https://api.codacy.com/api/v3 https://api.codacy.com/
Overview

The new endpoints allow you to access and manipulate the following resources, among others:

  • Analysis details, issue and ignored issue details, repository quality settings
  • Account details and API token management
  • Organization details and join request management
  • People management
  • Repository management and file details
  • Tool and code pattern details

The legacy endpoints allow you to access and manipulate the following resources:

  • Commit code quality details and deltas
  • Project details and configurations, file code quality and issue details

Important

If you're using Codacy Self-hosted you must update the base URL of the APIs to include your Codacy instance domain name. For example:

https://codacy.example.com/api/v3   

Authenticating requests to the Codacy API

Most API endpoints require that you provide either a project or account API token. After obtaining the necessary tokens, include them in your request headers using the format api-token: <token key> or project-token: <token key>.

For example, to make a request to an API v3 endpoint that requires an account API token:

curl -X GET https://api.codacy.com/api/v3/user/organizations/gh \
     -H "api-token: SjE9y7ekgKdpaCofsAhd"

Or to make a request to an API v2 endpoint that requires a project API token:

curl -X GET https://api.codacy.com/2.0/commit/da275c14ffab6e402dcc6009828067ffa44b7ee0 \
     -H "project-token: c9f2feb28e780acc8dc40754978b8bd9"

Share your feedback 📢

Did this page help you?

Thanks for the feedback! Is there anything else you'd like to tell us about this page?

We're sorry to hear that. Please let us know what we can improve:

Alternatively, you can create a more detailed issue on our GitHub repository.

Thanks for helping improve the Codacy documentation.

If you have a question or need help please contact support@codacy.com.

Last modified March 26, 2021