Manage scorecards
Define scorecards
Port offers a variety of ways to create, edit and delete scorecards:
- UI
- API
- Terraform
You can create, edit, or delete scorecards either from the catalog page or the Data model page.
- From the catalog page
- From the Data model page
Whether you create, edit, or delete a scorecard, follow the next steps, then proceed with the relevant section below.
-
Navigate to the Software Catalog page.
-
Go to a Scorecard catalog page in your catalog section.
Creating a scorecards catalog pageIf you don't have a scorecards catalog page, you can create one. To learn more, refer to the catalog page documentation.
To create a new scorecard:
-
Click the
+ Scorecardbutton in the top right corner of the page.
-
In the Basic Details tab, specify the scorecard's basic details:
Title- The scorecard's title.Identifier- The scorecard's unique identifier (must be unique among all scorecards).Blueprint- Select the blueprint you want to add the scorecard to.Filter- Filter which entities the scorecard applies to.
-
In the Rules tab, define the scorecard's rules:
- Add or remove levels, as well as edit their names and colors.
- Add rule elements to each level:
Title- The rule's title.Identifier- The rule's identifier.Description- The rule's description.Conditions- The rule's conditions.
-
Click
Saveto create the scorecard.
To edit an existing scorecard:
-
Click on the
...button in line that represents your scorecard in the table, then chooseEdit.
-
Edit the scorecard.
-
Click
Saveto apply your changes.
To delete a scorecard:
A Scorecard cannot be restored after deletion!
-
Click on the
...button in line that represents your scorecard in the table, then chooseDelete.
-
Confirm the deletion in the pop-up window.
Whether you create, edit, or delete a scorecard, follow the next steps, then proceed with the relevant section below.
-
Go to the Data model page of your portal.
-
Expand the relevant blueprint, and click on the
Scorecardstab.
To create a new scorecard:
-
Click on the
+ New scorecardbutton.
-
In the Basic Details tab, specify the scorecard's basic details:
Title- The scorecard's title.Identifier- The scorecard's unique identifier (must be unique among all scorecards).Blueprint- This field will already be preselected and non-editable, set to the blueprint you expanded.Filter- Filter which entities the scorecard applies to.
-
In the Rules tab, define the scorecard's rules:
- Add or remove levels, as well as edit their names.
- Add rule elements to each level:
Title- The rule's title.Identifier- The rule's identifier.Description- The rule's description.Conditions- The rule's conditions.
-
Click
Saveto create the scorecard.
To edit an existing scorecard
-
Click on the
...button in line that represents your scorecard, then chooseEdit.
-
Make your changes to the scorecard.
-
Click
Saveto apply your changes.
To delete a scorecard:
A Scorecard cannot be restored after deletion!
-
Click on the
...button in line that represents your scorecard, then chooseDelete.
-
Confirm the deletion in the pop-up window.
Scorecard JSON structure
Instead of using the form, you can also create or edit scorecards in JSON format.
Click on the {...} Edit JSON button in the top right corner of the scorecard creation or editing form.
Below is an example of a scorecard in JSON format:Ownership scorecard example (click to expand)
{
"identifier": "Ownership",
"title": "Ownership",
"rules": [
{
"identifier": "hasSlackChannel",
"title": "Has Slack Channel",
"level": "Silver",
"query": {
"combinator": "and",
"conditions": [
{
"operator": "isNotEmpty",
"property": "slackChannel"
}
]
}
},
{
"identifier": "hasTeam",
"title": "Has Team",
"level": "Bronze",
"query": {
"combinator": "and",
"conditions": [
{
"operator": "isNotEmpty",
"property": "$team"
}
]
}
}
]
}
Remember that an access token is necessary in order to make API requests. If you need to generate a new token, refer to Getting an API token.
Create scorecards
In order to create a scorecard from the API, you will make a POST request to the following URL: https://api.port.io/v1/blueprints/{blueprint_identifier}/entities.
Here are some request examples that will create the Scorecard of Ownership on the microservice Blueprint:
- Python
- Javascript
Create scorecards python example (click to expand)
# Dependencies to install:
# $ python -m pip install requests
# the access_token variable should already have the token from previous examples
import requests
API_URL = 'https://api.getport.io/v1'
blueprint_name = '_scorecard'
scorecard_definition = {
'identifier': 'Ownership',
'title': 'Ownership',
'properties': {
'blueprint': 'blueprint_identifier', # The blueprint the scorecard belongs to
'rules': [
{
'identifier': 'hasSlackChannel',
'title': 'Has Slack Channel',
'level': 'Silver',
'query': {
'combinator': 'and',
'conditions': [
{'operator': 'isNotEmpty', 'property': 'slackChannel'}
],
},
},
{
'identifier': 'hasTeam',
'title': 'Has Team',
'level': 'Bronze',
'query': {
'combinator': 'and',
'conditions': [
{'operator': 'isNotEmpty', 'property': '$team'}
],
},
},
],
}
}
headers = { 'Authorization': f'Bearer {access_token}'}
response = requests.post(f'{API_URL}/blueprints/{blueprint_name}/entities', json=scorecard_definition, headers=headers,)
Create scorecards javaScript example (click to expand)
// Dependencies to install:
// $ npm install axios --save
// the accessToken variable should already have the token from previous examples
const axios = require("axios").default;
const API_URL = "https://api.getport.io/v1";
const blueprintName = "_scorecard";
const scorecard_definition = {
identifier: "Ownership",
title: "Ownership",
properties: {
blueprint: "blueprint_identifier", // The blueprint the scorecard belongs to
rules: [
{
identifier: "hasSlackChannel",
title: "Has Slack Channel",
level: "Bronze",
query: {
combinator: "and",
conditions: [
{
operator: "isNotEmpty",
property: "slackChannel",
},
],
},
},
{
identifier: "hasTeam",
title: "Has Team",
level: "Silver",
query: {
combinator: "and",
conditions: [
{
operator: "isNotEmpty",
property: "$team",
},
],
},
},
],
}
};
const config = {
headers: {
Authorization: `Bearer ${accessToken}`,
},
};
const response = await axios.post(
`${API_URL}/blueprints/${blueprintName}/entities`,
scorecard_definition,
config
);
After creating the scorecards, you will see a new tab in the profile entity page of each of your blueprint's entities, showing the various scorecards levels.
For example, we can create the entity below:
{
"identifier": "cart-service",
"title": "Cart Service",
"icon": "Microservice",
"properties": {
"slackChannel": "https://slack.com",
"repoUrl": "https://github.com"
},
"relations": {}
}
And then look at the specific page of this entity, on the scorecards tab.

We can see that the hasSlackChannel rule passed because we provided one to that entity, while the hasTeam failed because we didn't provide any team.
Therefore the level of the entity is Bronze because it passed all the rules in the Bronze level (hasSlackChannel).
Update scorecards
To update a scorecard you can use two different URLs:
- Update a single Scorecard using the URL
https://api.port.io/v1/blueprints/{blueprint_identifier}/entities/{entity_identifier}. The request body will be the full Scorecard + the wanted changed values - Make a PUT request to the URL
https://api.port.io/v1/blueprints/{blueprint_identifier}/entities/{entity_identifier}. to multiple scorecards at once
The request body will include the existing body of the Scorecard, after the desired updates to the existing scorecard have been applied.
When using the multiple update Scorecards https://api.getport.io/v1/blueprints/{blueprint_identifier}/scorecards PUT request, keep in mind that you will see a new id property. This is used via Port to identify the scorecard in order to be able to update its properties.
Delete scorecards
A Scorecard cannot be restored after deletion!
- Make an HTTP PUT request and remove it from the array of the scorecards via the URL
https://api.getport.io/v1/blueprints/{blueprint_identifier}/scorecards. - Make an HTTP DELETE request to the URL
https://api.port.io/v1/blueprints/{blueprint_identifier}/entities/{entity_identifier}theblueprint_identifieris the identifier of the scorecard's blueprint, and theentity_identifieris the identifier of the scorecard we want to delete.
Create scorecards
In order to create a scorecard from the Terraform provider , you will need to use the port_entity resource.
Here is an example of how to create an Ownership scorecard with the Terraform provider:Terraform create example (click to expand)
resource "port_scorecard" "ownership" {
blueprint = "microservice"
identifier = "Ownership"
title = "Ownership"
rules = [
{
identifier = "hasSlackChannel"
title = "Has Slack Channel"
level = "Silver"
query = {
combinator = "and"
conditions = [
jsonencode({
operator = "isNotEmpty"
property = "slackChannel"
})
]
}
},
{
identifier = "hasTeam"
title = "Has Team"
level = "Bronze"
query = {
combinator = "and"
conditions = [
jsonencode({
operator = "isNotEmpty"
property = "$team"
})
]
}
}
]
}
Update scorecards
In order to update a scorecard with the Terraform provider, you will need to run the terraform apply -target=port_scorecard.<resourceId> command with the updated scorecard resource.
Delete Scorecards
A Scorecard cannot be restored after deletion!
In order to delete a scorecard using the Terraform provider, use the terraform destroy -target=port_scorecard.<resourceId> command with the scorecard resource you want to delete. (remember that it is also possible to remove the definition of the port_scorecard resource from the .tf file and run terraform apply)
Next steps
- Explore scorecard use-cases and automation use-cases for examples you can implement in your environment.
- Dive into advanced operations on Scorecards with our API ➡️