Interact with action runs
Once a self-service action or automation has been executed, an actionRun object will be created in Port.
This page will teach you how to use Port's API to obtain existing action runs and update them with additional metadata and information about the run. You can use this interaction to mark actions as completed or failed, and keep a consistent history of executed actions and their status.
Where to find your action runsโ
Non-admin rolesโ
Members and moderators can find their existing/finished action runs using one of the following methods:
-
The
My latest runslist - click on thebutton in the top-right corner of the page.
This will display the latest action runs that have been executed by the logged-in user:
You can also click on the
My run historybutton to see a table with all of the user's previous action runs. -
After executing an action from the self-service page, the
My latest runslist will open automatically, showing the newly created action run.
Admin roleโ
In addition to the methods mentioned above, admins can find action runs using one of the following methods:
-
The dedicated
Runs historytable:- Self-service actions - go to the self-service page of your portal, then click on the
button in the top-right corner.
- Automations - go to the automations page of your portal, then click on the
button in the top-right corner.
- Self-service actions - go to the self-service page of your portal, then click on the
-
Go to the audit logs page of your portal, then select the
Runstab.
This page will display all action runs that have been executed in your organization. -
Go the entity page of your desired entity, then select the
Runstab.
This page will display all action runs that have been executed for the selected Entity.
Fetch an action runโ
Once an actionRun is created, it will have a unique runId. Using this id, you can interact with the action run using Port's API.
Obtain a run's idโ
How to obtain the runId of an action by method:
- UI
- API
The runId will be shown in top-left corner of the action run page:

The runId will be returned in the response body of the action run request, under the context.runId key:
{
...
"context": {
"entity": null,
"blueprint": "microservice",
"runId": "r_QOz6WoOB1Q2lmhZZ"
},
...
}
Get a run's detailsโ
You can obtain the details of an action run by making a GET request to Port's API with the relevant {run_id}.
You will receive a response that looks like this:
{
"ok": true,
"run": {
"id": "r_QOz6WoOB1Q2lmhZZ",
"status": "IN_PROGRESS",
"blueprint": {
"identifier": "microservice",
"title": "Service"
},
"action": "create_microservice",
"endedAt": null,
"source": "UI",
"relatedEntityExists": false,
"relatedBlueprintExists": true,
"properties": {
"name": "my-microservice",
"region": "eu-west-1"
},
"createdAt": "2023-12-07T12:53:52.916Z",
"updatedAt": "2023-12-07T12:53:52.916Z",
"createdBy": "auth0|638879fa62c686d381b36ecb",
"updatedBy": "auth0|638879fa62c686d381b36ecb"
}
}
Update a runโ
You can use Port's API to update an the following properties of an action run:
status- The status of the action run. Initial value isIN_PROGRESS, can be set toSUCCESSorFAILURE.statusLabel- A custom message used to add information to the status of the action run.link- One or more links to external logs/jobs related to the action run.logs- Log entries that will be displayed in the action run's page in Port.summary- A summary of the action run, which will be displayed in the run's page in Port.
When using a Github workflow as the action backend, a Report workflow status option will be available and set to Yes by default. When using this option, Port will automatically update the status of the action run to SUCCESS or FAILURE according to the result of the Github workflow, so no manual update is required.
When using a Webhook as the action backend, a Request type option will be available. When set to sync, Port will automatically update the status of the action run according to the HTTP response code.
Run detailsโ
By sending a PATCH request to Port's API, you can do the following:
-
Update the run's status, by using the
statuskey with one of these values:SUCCESS,FAILURE.
This will mark the run as completed and show a visual indicator, for example:
-
Update the run's status label, by using the
statusLabelkey with a custom message.
If a label and a status are both provided, the custom message will be displayed with the status' color. For example, the following request body:{
"status": "FAILURE",
"statusLabel": "Wrong personal token provided"
}will display the following status label:
When providing a label only, the status will remain as
IN_PROGRESSand the label will be displayed with its neutral color. -
Add links to external logs of the job runners, by using the
linkkey - AWS Cloudwatch logs, Github Workflow job, Jenkins job, etc.
You can make a PATCH request to the endpoint as many times as you need until the action run has finished (as long as you don't terminate the run by changing the status).
Note that every patch request will override the previous information that was available for a given key. For example, when updating the link key multiple times, only the last provided value will be displayed in the action run.
Run logsโ
By sending a POST request to Port's API, you can do the following:
- Add log entries to the run's log, by using the
messagekey. - Update the run's status via the
terminationStatuskey with one of these values:SUCCESS,FAILURE. - Update the run's status label, by using the
statusLabelkey.
For example, let's update our action run log with the following POST request body:
{
"message": "my new log message"
}
Back in Port, the new log message will be displayed in the action run's page:
If we want to add a final log entry and also mark the action run as successful, we can use the following request body:
{
"message": "my new log message with final status",
"terminationStatus": "SUCCESS",
"statusLabel": "Completed successfully!"
}
A log message with the terminationStatus key can only be sent once for an action run. After it is sent, the run status is marked accordingly and the run can no longer be modified.
Cancel execution requestโ
If a user executes a self-service action that requires approval, and the run's Status is still Waiting for approval, they can withdraw their request.
To cancel a pending execution request:
- Click on the
button in the top-right corner of the page.
- Navigate to the relevant run page.
- Click on the
...button in the top-right corner of the run'sDetailswindow, then click onEdit. - Change the
Statusto FAILURE. - Click Save.
The run will then be marked as failed, and will no longer require approval or be eligible for execution.
Re-run actionโ
If a user wants to re-run an action using the same inputs as a previous run, they can follow these steps:
- Click on the
button in the top-right corner of the page.
- Navigate to the relevant run page.
- Click on the
Re-run actionin the top right corner of the action run page. - Execute the action again by clicking on the
Executebutton.
Tie entities to action runโ
You can also add additional context and metadata to an action run by attaching a run_id query parameter to every API route that creates or changes an entity (i.e. POST, PUT, PATCH and DELETE entity requests).
By adding the run_id parameter, you reflect the change made to the Entity as part of the set of steps the action run performed during its runtime.
Tying Entities to an action run is only possible when an action run is in the IN_PROGRESS status.
For example, say you send a POST request to create a new entity, and add your run_id as a query parameter. An example python function that achieves this may look like this:
Python create entity example (click to expand)
def create_entity():
headers = {
'Authorization': 'Bearer [YOUR_ACCESS_TOKEN]'
}
query = {
"run_id": "[RUN_ID]",
"upsert": "true"
}
body = {
"identifier": "[ENTITY_IDENTIFIER]",
"title": "[ENTITY_TITLE]",
}
entity_resp = requests.post("https://api.getport.io/v1/blueprints/[TARGET_BLUEPRINT_ID]/entities", headers=headers, params=query, json=body)
pprint(entity_resp.json()['entity'])
return entity_resp.json()['entity']['identifier']
Port exposes two API instances, one for the EU region of Port, and one for the US region of Port.
- If you use the EU region of Port (https://app.port.io), your API URL is
https://api.port.io. - If you use the US region of Port (https://app.us.port.io), your API URL is
https://api.us.port.io.
Now when you look at the action run page in Port, you will see the new Entity listed under the Affected Entities tab:
It is possible to create, update or delete multiple entities as part of the steps taken by a single action run, and all of these changes will be reflected in the action run page.