B2B API Create Company with existing contact

Shopify Partner
1 0 1

When you create a company in the admin panel it allows you to select from an existing customer. WHen you create one in the API (https://shopify.dev/docs/api/admin-graphql/unstable/mutations/companyCreate#field-companycreateinput...) it only seems to allow creation of a new customer with the new company.

How do i create a new company and attach an existing customer through the API?

Anybody know?

Replies 2 (2)

Shopify Staff
1315 215 454

Hi @quickfire ,


You are correct. 


Currently when you are creating a company for B2B you only have the option to do so with a 'new contact' and not an existing one. However, once you have created a company via the api, you can use the companyAssignCustomerAsContact mutation to add in an existing customer. 


This is a good example of the subtle differences between what you can do in the admin vs what you can accomplish via the API. I will pass this along to our development team for future consideration.


Hope that helps! 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Shopify Partner
32 0 8

Currently cant even add a company via the GraphQL API - "Invalid input" is what you get