Public API¶
We are expanding the API with every release to make more analysis information available. Contact Codescene, and we are happy to share our detailed plans and get your feedback.
You can get the following information from the API:
Using CodeScene’s REST API¶
The REST API documentation URL¶
The REST API token¶

Fig. 171 List Api tokens¶

Fig. 172 Add Api token¶

Fig. 173 Api token created¶
'Authorization: Bearer <your token>'
.Project endpoints¶
Projects list¶
curl -X GET --header 'Accept: application/json' --header 'Authorization: Bearer <token>' \
'https://api.codescene.io/v2/projects'
New Project¶
curl -X POST --header 'Content-Type: application/json' --header 'Authorization: Bearer <token>' \
--data "@./project.json" 'https://api.codescene.io/v2/projects/new'
Replace
./project.json
with a valid a path to your project configuration.Example of
./project.json
{
"config": {
"name" : "test",
"repo-paths" : ["https://yourprovider.com/mycompany/myproject.git"],
"developer-configuration" : 99
}
}
name
is optional, if missing CodeScene will use the project name from the first repositorythe repo paths must contain only urls accessible by the user which created the token
developer-configuration
is optional, replace99
with a valid id taken from the developer settings list results.
Analysis List of a project¶
curl -X GET --header 'Accept: application/json' --header 'Authorization: Bearer <token>' \
'https://api.codescene.io/v2/projects/{project-id}/analyses'
Replace
{project-id}
with a valid id taken from the project list results.
Single analysis details¶
curl -X GET --header 'Accept: application/json' --header 'Authorization: Bearer <token>' \
'https://api.codescene.io/v2/projects/{project-id}/analyses/{analysis-id}'
Replace
{project-id}
with a valid id taken from the project list results.Replace
{analysis-id}
with a valid id taken from the analysis list results.
curl -X GET --header 'Accept: application/json' --header 'Authorization: Bearer <token>' \
'https://api.codescene.io/v2/projects/{project-id}/analyses/latest'
Replace
{project-id}
with a valid id taken from the project list results.
Files list from an analysis¶
curl -X GET --header 'Accept: application/json' --header 'Authorization: Bearer <token>' \
'https://api.codescene.io/v2/projects/{project-id}/analyses/{analysis-id}/files?page={page}&page_size={page_size}&order_by={order_by}'
Replace
{project-id}
with a valid id taken from the project list results.Replace
{analysis-id}
with a valid id taken from the analysis list results.Replace
{page}
with required page to return. If page parameter is omitted the default value is 1.Replace
{page_size}
with the number of files to return for a page. If page_size parameter is omitted the default value is 100.Replace
{order_by}
with one of the following values: “lines_of_code”, “change_frequency”, “number_of_defects”, “code_health” or “cost”. If order_by parameter is omitted the default value is “change_frequency”.
curl -X GET --header 'Accept: application/json' --header 'Authorization: Bearer <token>' \
'https://api.codescene.io/v2/projects/{project-id}/analyses/latest/files?page={page}&page_size={page_size}&order_by={order_by}'
Replace
{project-id}
with a valid id taken from the project list results.Replace
{page}
with required page to return. If page parameter is omitted the default value is 1.Replace
{page_size}
with the number of files to return for a page. If page_size parameter is omitted the default value is 100.Replace
{order_by}
with one of the following values: “lines_of_code”, “change_frequency”, “number_of_defects”, “code_health” or “cost”. If order_by parameter is omitted the default value is “change_frequency”.
Components list from an analysis¶
curl -X GET --header 'Accept: application/json' --header 'Authorization: Bearer <token>' \
'https://api.codescene.io/v2/projects/{project-id}/analyses/{analysis-id}/components'
Replace
{project-id}
with a valid id taken from the project list results.Replace
{analysis-id}
with a valid id taken from the analysis list results.
curl -X GET --header 'Accept: application/json' --header 'Authorization: Bearer <token>' \
'https://api.codescene.io/v2/projects/{project-id}/analyses/latest/components'
Replace
{project-id}
with a valid id taken from the project list results.
Single components details from an analysis¶
curl -X GET --header 'Accept: application/json' --header 'Authorization: Bearer <token>' \
'https://api.codescene.io/v2/projects/{project-id}/analyses/{analysis-id}/components/{component-name}'
Replace
{project-id}
with a valid id taken from the project list results.Replace
{analysis-id}
with a valid id taken from the analysis list results.Replace
{component-name}
with a valid name taken from the components list results.
curl -X GET --header 'Accept: application/json' --header 'Authorization: Bearer <token>' \
'https://api.codescene.io/v2/projects/{project-id}/analyses/latest/components/{component-name}'
Replace
{project-id}
with a valid id taken from the project list results.Replace
{component-name}
with a valid name taken from the components list results.
Component file list from an analysis¶
curl -X GET --header 'Accept: application/json' --header 'Authorization: Bearer <token>' \
'https://api.codescene.io/v2/projects/{project-id}/analyses/{analysis-id}/components/{component-name}/files?page={page}&page_size={page_size}&order_by={order_by}'
Replace
{project-id}
with a valid id taken from the project list results.Replace
{analysis-id}
with a valid id taken from the analysis list results.Replace
{component-name}
with a valid id taken from the component list results.Replace
{page}
with required page to return. If page parameter is omitted the default value is 1.Replace
{page_size}
with the number of files to return for a page. If page_size parameter is omitted the default value is 100.Replace
{order_by}
with one of the following values: “lines_of_code”, “change_frequency”, “number_of_defects”, “code_health” or “cost”. If order_by parameter is omitted the default value is “change_frequency”.
curl -X GET --header 'Accept: application/json' --header 'Authorization: Bearer <token>' \
'https://api.codescene.io/v2/projects/{project-id}/analyses/latest/components/{component-name}/files?page={page}&page_size={page_size}&order_by={order_by}'
Replace
{project-id}
with a valid id taken from the project list results.Replace
{component-name}
with a valid id taken from the component list results.Replace
{page}
with required page to return. If page parameter is omitted the default value is 1.Replace
{page_size}
with the number of files to return for a page. If page_size parameter is omitted the default value is 100.Replace
{order_by}
with one of the following values: “lines_of_code”, “change_frequency”, “number_of_defects”, “code_health” or “cost”. If order_by parameter is omitted the default value is “change_frequency”.
Delta Analyses List of a project¶
curl -X GET --header 'Accept: application/json' --header 'Authorization: Bearer <token>' \
'https://api.codescene.io/v2/projects/{project-id}/delta-analyses'
Replace
{project-id}
with a valid id taken from the project list results.
Single delta analysis details¶
curl -X GET --header 'Accept: application/json' --header 'Authorization: Bearer <token>' \
'https://api.codescene.io/v2/projects/{project-id}/delta-analyses/{delta-analysis-id}'
Replace
{project-id}
with a valid id taken from the project list results.Replace
{delta-analysis-id}
with a valid id taken from the delta analysis list results.
Commit activity trend from an analysis¶
curl -X GET --header 'Accept: application/json' --header 'Authorization: Bearer <token>' \
'https://api.codescene.io/v2/projects/{project-id}/analyses/{analysis-id}/commit-activity'
Replace
{project-id}
with a valid id taken from the project list results.Replace
{analysis-id}
with a valid id taken from the analysis list results.
curl -X GET --header 'Accept: application/json' --header 'Authorization: Bearer <token>' \
'https://api.codescene.io/v2/projects/{project-id}/analyses/latest/commit-activity'
Replace
{project-id}
with a valid id taken from the project list results.
Get Project Badge Status¶
CodeScene support the following badges: code-health, missed-goals, system-mastery
curl -X GET --header 'Accept: application/json' --header 'Authorization: Bearer <token>' \
'https://api.codescene.io/v2/projects/{project_id}/badges'
Replace
{project_id}
with a valid id taken from the project list results.
Update Project Badge Status¶
curl -X PUT --header 'Content-Type: application/json' --header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' -d '{"code-health":true, "missed-goals": true ,"system-mastery": false}' \
'https://api.codescene.io/v2/projects/{project_id}/badges'
Replace
{project_id}
with a valid id taken from the project list results.
Teams and Developers endpoints¶
Developer Settings list¶
curl -X GET --header 'Accept: application/json' --header 'Authorization: Bearer <token>' \
'https://api.codescene.io/v2/developer-settings'
Teams list¶
curl -X GET --header 'Accept: application/json' --header 'Authorization: Bearer <token>' \
'https://api.codescene.io/v2/developer-settings/{developer_setting_id}/teams'
Replace
{developer_setting_id}
with a valid id taken from the developer settings list results.
Create team¶
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' -d '{ "team_name": "my-new-team"}' \
'https://api.codescene.io/v2/developer-settings/{developer_setting_id}/teams/new'
Replace
{developer_setting_id}
with a valid id taken from the developer settings list results.
Update team¶
curl -X PUT --header 'Content-Type: application/json' --header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' -d '{ "team_name": "my-updated-team"}' \
'https://api.codescene.io/v2/developer-settings/{developer_setting_id}/teams/{team_id}'
Replace
{developer_setting_id}
with a valid id taken from the developer settings list results.Replace
{team_id}
with a valid id taken from the teams list results.
Delete team¶
curl -X DELETE --header 'Accept: application/json' --header 'Authorization: Bearer <token>' \
'https://api.codescene.io/v2/developer-settings/{developer_setting_id}/teams/{team_id}'
Replace
{developer_setting_id}
with a valid id taken from the developer settings list results.Replace
{team_id}
with a valid id taken from the teams list results.
Developer list¶
curl -X GET --header 'Accept: application/json' --header 'Authorization: Bearer <token>' \
'https://api.codescene.io/v2/developer-settings/{developer_setting_id}/developers'
Replace
{developer_setting_id}
with a valid id taken from the developer settings list results.
Update developer¶
curl -X PUT --header 'Content-Type: application/json' --header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' -d '{ "team_id": 12, "former_contributor": true, "exclude_from_all_analyses": true}' \
'https://api.codescene.io/v2/developer-settings/{developer_setting_id}/developers/{developer_id}'
Replace
{developer_setting_id}
with a valid id taken from the developer settings list results.Replace
{developer_id}
with a valid id taken from the developers list results.Set the team_id to a valid id taken from teams list if you need to assign the current developer to that team.
The only updateable attributes of a developer are the team_id, former_contributor and exclude_from_all_analyses
The payload can contain any of the attributes or only some of them.
Delete developer¶
curl -X DELETE --header 'Accept: application/json' --header 'Authorization: Bearer <token>' \
'https://api.codescene.io/v2/developer-settings/{developer_setting_id}/developers/{developer_id}'
Replace
{developer_setting_id}
with a valid id taken from the developer settings list results.Replace
{developer_id}
with a valid id taken from the developers list results.
Remove Developer from Team¶
curl -X DELETE --header 'Accept: application/json' --header 'Authorization: Bearer <token>' \
'https://api.codescene.io/v2/developer-settings/{developer_setting_id}/developers/{developer_id}/team'
Replace
{developer_setting_id}
with a valid id taken from the developer settings list results.Replace
{developer_id}
with a valid id taken from the developers list results.
KPI trends endpoints¶
The KPI trends endpoints lets you get the data behind the graphs and metrics found on CodeScenes 4-factors dashboards, as described in From Code to Delivery: the 4 factors model.
A full and current documentation of the endpoints can be found at the REST API documentation URL, see above for usage and authorization.