GraphQL API - How to retrieve the status of a company?

Topic summary

Goal: Identify which B2B companies are eligible to place orders via Shopify’s Admin GraphQL.

Key points:

  • The Company object has no explicit “Approved” status. Shopify docs note a companyContact must be present to create orders/draft orders.
  • Eligibility can be inferred using companies and their contactRoles/role assignments rather than a status field.

Implementation shared:

  • Query companies and filter for those with at least one role assignment on a location, plus retrieve main contact details.
  • Example fields used: companies → locations → roleAssignments → role.name; contacts(query: “isMainContact:true”) → customer email/multipassIdentifier.

Outcome:

  • This approach satisfied the request; the original poster confirmed it provides the needed signal to filter companies allowed to order.
  • No official “Approved” flag exists; using presence of contacts/roles is the practical method.

Notes:

  • A code snippet is central to the solution; a screenshot was included but not required for understanding.
  • Discussion concluded with a workable solution; no unresolved questions were left.
Summarized with AI on January 7. AI used: gpt-5.

Hi,

I’m new to Shopify and I’m working on the GraphQL APIs. I’m looking for a way to get all Companies info for Approved Companies. Or more specifically, where a customer is approved for ordering. Or at least looking for a way to distinguish their status. I haven’t been able to understand where to see this through the Graph APIs.

Any pointers would be greatly appreciated.

Thanks you

Hi @mariounkel ,

The Company object in GraphQL doesn’t have an “Approved” field, but our guide on creating companies mentions that “A companyContact must be added to create orders and draft orders.”

The companies query can be used to retrieve a list of your store’s companies, and their contactRoles connection could also be used to determine their eligibility for making orders.

Hope that helps!

  • James

Hi,

Thanks for your answer. Yes I found the link. This gave me the info I was looking for. And with this I will filter out the companies that have a least 1 role assignment.

query MyQuery {
  companies(first: 10) {
    edges {
      node {
        id
        name
        externalId
        locations(first: 1) {
          edges {
            node {
              name
              roleAssignments(first: 10) {
                edges {
                  node {
                    role {
                      name
                    }
                  }
                }
              }
            }
          }
        }
        contacts(first: 10, query: "isMainContact:true") {
          edges {
            node {
              isMainContact
              id
              customer {
                email
                multipassIdentifier
              }
            }
          }
        }
      }
    }
  }
}