TimeHorse You don't need an ID when creating a new email address. I suspect you're calling the wrong API method.
Here's an example of how to create a forwarding email address, then look up its ID, then add a second forwarding address to it:
import requests
# your API token
TOKEN = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
headers = { 'Content-Type': 'application/json', 'Authorization': f'Token {TOKEN}' }
# create a forwarding address
email = 'me@domain.com'
forwards = ['me@otherdomain.com',]
data = [{'source':email, 'forwards':forwards}]
response = requests.post('https://my.opalstack.com/api/v1/address/create/', json=data, headers=headers)
# if you need to modify the address immediately the new address info including ID is now in response.json()[0]:
# [{'id': 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX',
# 'state': 'PENDING_CREATE',
# 'ready': False,
# 'source': 'me@domain.com',
# 'destinations': [],
# 'forwards': ['me@otherdomain.com']}]
# if you need to modify the address later, first look up the address from address/list:
response = requests.get('https://my.opalstack.com/api/v1/address/list/', json=data, headers=headers)
address = [i for i in response.json() if v['source'] == email][0]
# the email address info is now stored in the var 'address'
# {'id': 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX',
# 'state': 'READY',
# 'ready': True,
# 'source': 'me@domain.com',
# 'destinations': [],
# 'forwards': ['me@otherdomain.com']}
# now add a new forward to the address using the info you looked up:
other_forward = 'metoo@anotherdomain.com'
address['forwards'].append(other_forward)
data = [{'id':address['id'],'forwards':address['forwards']}]
response = requests.post('https://my.opalstack.com/api/v1/address/update/', json=[address,], headers=headers)
# the updated address info is now in response.json()[0]:
# [{'id': 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX',
# 'state': 'PENDING_UPDATE',
# 'ready': False,
# 'source': 'me@domain.com',
# 'destinations': [],
# 'forwards': ['me@otherdomain.com', 'metoo@anotherdomain.com']}]