---
title: Download sample scripts using the API
description: Examples of scripts for accessing and retrieving Portal data via the API across different usage scenarios.
---

[Skip to content](https://content.xmco.fr/en/base-de-connaissances/download-sample-scripts-using-the-api#main-content)

- [English](https://content.xmco.fr/en/base-de-connaissances/download-sample-scripts-using-the-api)
- [Français](https://content.xmco.fr/fr/base-de-connaissances/exemples-de-scripts-api)

English

Show submenu for translations

![](https://content.xmco.fr/hubfs/xmco.svg)

- [View your tickets](https://content.xmco.fr/tickets-view)
- [Log out](https://content.xmco.fr/_hcms/mem/logout)

Open main navigation

Close main navigation

- [View your tickets](https://content.xmco.fr/tickets-view)
- [Log out](https://content.xmco.fr/_hcms/mem/logout)
- - [English](https://content.xmco.fr/en/base-de-connaissances/download-sample-scripts-using-the-api)
    - [Français](https://content.xmco.fr/fr/base-de-connaissances/exemples-de-scripts-api)

  English
  
  Show submenu for translations
- [Contact support](https://content.xmco.fr/en/support)

[Contact support](https://content.xmco.fr/en/support?hsLang=en)

 How can we help you?

- There are no suggestions because the search field is empty.

1. [Base de connaissances](https://content.xmco.fr/en/base-de-connaissances?hsLang=en)
2. [Use the API and connectors](https://content.xmco.fr/en/base-de-connaissances/use-the-api-and-connectors?hsLang=en)
3. [Understanding and using the Portal API](https://content.xmco.fr/en/base-de-connaissances/use-the-api-and-connectors?hsLang=en#understanding-and-using-the-portal-api)

# Download sample scripts using the API

## In this article, you will have access to scripts that retrieve and access Portal data via the API, with examples of their use.

This project aims at providing simple examples of scripts to interact with the CERT-XMCO portal API. 

11 scripts written in Python are thus made available covering a large range of the features of the API in order to : 

- learn how to authenticate yourself ;
- get Watch information (scopes, all advisories or advisories filtered)
- get Serenety information (scopes, assets and their properties)
- get action tickets information (from the whole company, assigned to me or associated to a specific module or specific scope)
- update action tickets.

### **Installation**

To use the scripts, you need a Python 3 environment. 

Once the project is fetched, it will be necessary to use the following command to install the few dependencies: 

```
pip install -r requirements.txt
```

Each script can then be executed separately. 

For presentation purposes, several scripts have a fixed value for scope or ticket \`\_id\`. **Please bear in mind to modify these on your first launch of the script.**

 

### **Authentication**

- API key could be obtained as described in the documentation : https://leportail.xmco.fr/doc/api ;
- Your API key must be added in the file \`const.py\` ( variable \`API\_KEY\`) ;
- We recommend using a dedicated service account when used in production mode ;

### **List of scripts available**

- **\`1.get\_watch\_advisories.py\`:** to learn how to get all recent watch advisories
- **\`2.get\_watch\_scope.py\`**: to learn how to get all Watch scopes created information
- **\`3.get\_watch\_advisories\_by\_scope.py\`**: to learn how to get all Watch advisories filtered to one or multiple scopes
- **\`4.get\_serenety\_scope.py\`:** to learn how to get all Serenety scopes created
- **\`5.get\_serenety\_assets.py\`**: to learn how to get all Serenety assets created including their properties (SSLLABS, open ports, etc.)
- **\`6.get\_tickets\_company.py\`**: to learn how to get all action tickets created
- **\`7.get\_tickets\_assigned\_to\_me.py\`**: to learn how to get all action tickets assigned to me
- **\`8.get\_tickets\_by\_module.py**\`: to learn how to get all action tickets filtered by modules
- **\`9.get\_ticket\_by\_scope.py\`**: to learn how to get all action tickets filtered by scopes
- **\`10.update\_ticket.py\`:** to learn how to update an action ticket
- **\`11.update\_status\_serenety\_ticket.py\`**: to learn how to mark a serenety ticket as resolved
- **\`12.send\_ticket\_to\_the\_hive.py\`**: lean how to forward ticket created during the last hour in the hive 
    - (**AUTH\_HIVE\_TOKEN** and **THE\_HIVE\_CREATE\_ENDPOINT** mentioned in const.py needs to be updated).

### Download the scripts

[![Icône téléchargement](https://www.hautesterres.fr/wp-content/uploads/2022/07/Icone-telechargement.png)](https://content.xmco.fr/hubfs/Base%20de%20connaissances%20-%20Guide%20utilisateur%20et%20docs%20%C3%A0%20t%C3%A9l%C3%A9charger/xmco-leportail-api-demo.zip?hsLang=en)

[Click here to download the scripts](https://content.xmco.fr/hubfs/Base%20de%20connaissances%20-%20Guide%20utilisateur%20et%20docs%20%C3%A0%20t%C3%A9l%C3%A9charger/xmco-leportail-api-demo.zip?hsLang=en)

- [Set up your account and company](https://content.xmco.fr/en/base-de-connaissances/set-up-your-account-and-company?hsLang=en#main-content)

    - [Log in](https://content.xmco.fr/en/base-de-connaissances/set-up-your-account-and-company?hsLang=en#log-in)
    - [Integrate your SSO](https://content.xmco.fr/en/base-de-connaissances/set-up-your-account-and-company?hsLang=en#integrate-your-sso)
    - [Manage your account](https://content.xmco.fr/en/base-de-connaissances/set-up-your-account-and-company?hsLang=en#manage-your-account)
    - [Manage your company](https://content.xmco.fr/en/base-de-connaissances/set-up-your-account-and-company?hsLang=en#manage-your-company)
- [Discover the Serenety module](https://content.xmco.fr/en/base-de-connaissances/discover-the-serenety-module?hsLang=en#main-content)

    - [Documentation Serenety](https://content.xmco.fr/en/base-de-connaissances/discover-the-serenety-module?hsLang=en#documentation-serenety)
    - [Set up Serenety in just a few clicks](https://content.xmco.fr/en/base-de-connaissances/discover-the-serenety-module?hsLang=en#set-up-serenety-in-just-a-few-clicks)
    - [Serenety key features](https://content.xmco.fr/en/base-de-connaissances/discover-the-serenety-module?hsLang=en#serenety-key-features)
- [Discover Yuno](https://content.xmco.fr/en/base-de-connaissances/discover-yuno?hsLang=en#main-content)

    - [Set up Yuno in just a few clicks](https://content.xmco.fr/en/base-de-connaissances/discover-yuno?hsLang=en#set-up-yuno-in-just-a-few-clicks)
    - [Advanced settings](https://content.xmco.fr/en/base-de-connaissances/discover-yuno?hsLang=en#advanced-settings)
    - [Yuno's main pages](https://content.xmco.fr/en/base-de-connaissances/discover-yuno?hsLang=en#yunos-main-pages)
    - [FAQ](https://content.xmco.fr/en/base-de-connaissances/discover-yuno?hsLang=en#faq)
    - [Download the complete documentation](https://content.xmco.fr/en/base-de-connaissances/discover-yuno?hsLang=en#download-the-complete-documentation)
- [Use the API and connectors](https://content.xmco.fr/en/base-de-connaissances/use-the-api-and-connectors?hsLang=en#main-content)

    - [Understanding and using the Portal API](https://content.xmco.fr/en/base-de-connaissances/use-the-api-and-connectors?hsLang=en#understanding-and-using-the-portal-api)
    - [Connect to our Portal](https://content.xmco.fr/en/base-de-connaissances/use-the-api-and-connectors?hsLang=en#connect-to-our-portal)
- [Legal information](https://content.xmco.fr/en/base-de-connaissances/legal-information?hsLang=en)

[![](https://content.xmco.fr/hubfs/xmco.svg)](https://www.xmco.fr)

[mailto:support@xmco.fr](mailto:support@xmco.fr) <https://www.linkedin.com/company/xmco>

Copyright © 2026, XMCO