To add tags to an event using the Splunk Phantom API, you can use the following Python code:

import requests
import json

# Define the API endpoint URL
url = 'https://phantom.example.com/rest/event'

# Define the event ID and tags to be added
event_id = '123456'
tags = ['tag1', 'tag2', 'tag3']

# Define the API request headers and payload
headers = {'ph-auth-token': 'YOUR_API_KEY', 'Content-Type': 'application/json'}
payload = {'id': event_id, 'tags_add': tags}

# Send the API request to add tags to the event
response = requests.post(url, headers=headers, data=json.dumps(payload), verify=False)

# Check the API response status code
if response.status_code == 200:
    print('Tags added to event successfully.')
else:
    print('Error adding tags to event.')

In this code, you first define the API endpoint URL for the event. You then define the event ID and the tags you want to add to the event. Next, you define the API request headers, including your API key, and the payload, which specifies the event ID and the tags to add. You then send the API request using the requests.post() method and check the API response status code to ensure the tags were added successfully.

Splunk Phantom API: Add Tags to an Event