API domains_domain_add

hi, I want to add a domain using the remote API.
But when I use the example and change the $client_id to a existing clientid. The domain is added but there is no client attached to it.
Are there other API I need to call, to add a domain to client from the API.
When I login afterwards as admin I can't edit this domain to attach it to user.