It appears that you want to create a subdomain to a root IP address, and then forward a subdomain from a different domain to this subdomain.
First you would create an A
record for the api.company.com
subdomain as demonstrated here under "Example 1" (ignoring the FTP part; also note that www
is considered a subdomain as well, just like api
).
So in the DNS tables for company.com
you'd create an A
record for:
api.company.com A 1.2.3.4
This establishes an alias record for host api.company.com
at IP address 1.2.3.4
Next you'd create a CNAME to this external host as demonstrated here under "Example 3". So in the DNS tables for website.com
you'd create a CNAME record for:
api CNAME api.company.com.
This points api.website.com
-> api.company.com
Then you'd need to wait 24-48 hours for these DNS changes to propagate to DNS servers throughout the Internet in order for these subdomains to resolve properly, so don't make any other changes during that time.