Get API Specification
To access the CP Portal via API you can:
- Get Open API swagger.yaml for Automation APIs and use it for your language to generate client code (check swagger-codegen). Use the generated code to access the system in your scripts/code.
- Get a pre-created client library for your language:
- Python: not yet published
- nodejs (JS/TS): not yet published
Authentication
To authenticate requests X-API-KEY should be provided in all REST API calls.
To acquire the API-KEY you need to be a user of the CP Portal and then request it via the interface (navigate to your user's settings page, and generate the key):
- To generate an API key you will be asked to re-authenticate yourself
- The generated key will only be shown right after generation. Please keep it in a secure place
- If you forget your API key, you can generate a new one. Please do note that after a fresh key is generated, the old one will stop working

Image: User page to generate an API key
Endpoints
The Portal API is reachable via the link: https://automation-api.portal.img.astrazeneca.com.
All API endpoints are protected with a rate limit. There are 3 levels of rate limits applied to API endpoints:
- High: 1200 requests per user per minute
- Medium: 240 requests per user per minute
- Low: 40 requests per user per minute
If you experience any restrictions in your automation processes, please reach out to us and we will work together to adjust the limits for your automation.
Examples
Jupyter notebook example
Jupyter notebook with documentation on how to use CP Portal's API can be found here:
https://gitlab.img.astrazeneca.net/portal/api-gateways/automation-api-gateway/-/blob/master/docs/playground.ipynbcurl example
To get slides of a project (via curl):
# get all slides with all metadata fields for a project with id 5e57b8d248dbe6f07e5f44a0 $ curl --location --request GET 'https://automation-api.portal.img.astrazeneca.com/v1/projects/5e57b8d248dbe6f07e5f44a0/slides' \ --header 'X-API-KEY: apiKeyapiKeyapiKeyapiKeyapiKeyapiKey' [ { "id": "5e57b95c48dbe6679a5f44a1", "acronym": null, "projectId": "5e57b8d248dbe6f07e5f44a0", "imageSet": "Harald", "blockId": "Block2", "comment": "Score or other score", "cohort": "DP cohort", "drugId": "DS-8201", ...
To get annotation sets of a slide of a project (via requests module in Python):
$ cat fetch-annotation-sets.py import requests url = "https://automation-api.portal.img.astrazeneca.com/v1/projects/5e57b8d248dbe6f07e5f44a0/slides/5e57b95c48dbe6679a5f44a1/annotation-sets" payload={} headers = { 'X-API-KEY': 'apiKeyapiKeyapiKeyapiKeyapiKeyapiKey' } response = requests.request("GET", url, headers=headers, data=payload) print(response.text) $ python ./fetch-annotation-sets.py [ { "internal": { "createdBy": "edbc61a4-ada9-4689-9c5d-8c20307294ef", "version": 1 }, "projectId": "5e57b8d248dbe6f07e5f44a0", "slideId": "5e57b95c48dbe6679a5f44a1", "name": "default", "createdAt": "2020-04-03T11:13:47.975Z", "updatedAt": "2020-04-03T11:13:47.975Z", "id": "5e871a6ba26a209586df3356" }, { "internal": { "createdBy": "840c5dfe-fdd5-4f14-9e8d-cb6dae997a16", "version": 1 }, ...