Get company orders
Prerequisites
- Merchant API key (
X-ApiKey) - Authenticated user session (JWT bearer token)
- User associated with a company account
Goals
- Fetch all orders placed by any buyer in the authenticated user's company
- Display a company-wide order history overview
- Understand how company orders differ from individual user orders
Architecture at a glance
- Authenticate company user → Query
getCompanyOrders→ Receive orders from all company buyers
APIs used
- Merchant API:
https://merchantapi.geins.io/graphql
Step-by-step
Query company orders
The getCompanyOrders query returns orders placed by all buyers linked to the authenticated user's company — not just the current user's own orders. This is the key difference from getOrders, which only returns the individual user's orders.
If the authenticated user is not a member of a company, the query returns an empty list.
Request example
query getCompanyOrders(
$channelId: String
$languageId: String
$marketId: String
) {
getCompanyOrders(
channelId: $channelId
languageId: $languageId
marketId: $marketId
) {
id
publicId
createdAt
status
orderTotal {
sellingPriceIncVat
sellingPriceIncVatFormatted
}
currency
cart {
items {
id
}
}
shippingAddress {
firstName
lastName
company
addressLine1
city
zip
country
}
}
}
{
"Accept": "application/json",
"X-ApiKey": "{MERCHANT_API_KEY}",
"Authorization": "Bearer {JWT_TOKEN}"
}
{
"channelId": "{CHANNEL_ID}",
"languageId": "{LANGUAGE_ID}",
"marketId": "{MARKET_ID}"
}
curl -X POST https://merchantapi.geins.io/graphql \
-H "Accept: application/json" \
-H "X-ApiKey: {MERCHANT_API_KEY}" \
-H "Authorization: Bearer {JWT_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"query":"query getCompanyOrders($channelId:String,$languageId:String,$marketId:String){getCompanyOrders(channelId:$channelId,languageId:$languageId,marketId:$marketId){id publicId createdAt status orderTotal{sellingPriceIncVat sellingPriceIncVatFormatted} currency cart{items{id}} shippingAddress{firstName lastName company addressLine1 city zip country}}}","variables":{"channelId":"{CHANNEL_ID}","languageId":"{LANGUAGE_ID}","marketId":"{MARKET_ID}"}}'
channelId, languageId, and marketId arguments are optional and can be omitted to use default values.Response example
200 OK{
"data": {
"getCompanyOrders": [
{
"id": 12345,
"publicId": "ORD-2025-001234",
"createdAt": "2025-10-25T14:30:00Z",
"status": "Shipped",
"orderTotal": {
"sellingPriceIncVat": 4500.00,
"sellingPriceIncVatFormatted": "4,500.00 SEK"
},
"currency": "SEK",
"cart": {
"items": [
{ "id": 1 },
{ "id": 2 }
]
},
"shippingAddress": {
"firstName": "Anna",
"lastName": "Svensson",
"company": "Acme Trading AB",
"addressLine1": "Industrivägen 10",
"city": "Stockholm",
"zip": "11122",
"country": "SE"
}
},
{
"id": 12340,
"publicId": "ORD-2025-001229",
"createdAt": "2025-09-15T10:15:00Z",
"status": "Delivered",
"orderTotal": {
"sellingPriceIncVat": 1899.00,
"sellingPriceIncVatFormatted": "1,899.00 SEK"
},
"currency": "SEK",
"cart": {
"items": [
{ "id": 1 }
]
},
"shippingAddress": {
"firstName": "Erik",
"lastName": "Johansson",
"company": "Acme Trading AB",
"addressLine1": "Lagervägen 5",
"city": "Stockholm",
"zip": "11133",
"country": "SE"
}
}
]
}
}
Combine with individual order details
Use getOrder with a specific orderId from the list to retrieve full details for any company order — including payment, shipping, and refund information.
Request example
query getOrder(
$orderId: Int!
$channelId: String
$languageId: String
$marketId: String
) {
getOrder(
orderId: $orderId
channelId: $channelId
languageId: $languageId
marketId: $marketId
) {
id
publicId
createdAt
completedAt
status
orderTotal {
sellingPriceIncVat
sellingPriceExVat
vat
}
shippingAddress {
firstName
lastName
company
addressLine1
city
zip
country
}
paymentDetails {
displayName
}
shippingDetails {
name
parcelNumber
trackingLink
}
}
}
{
"Accept": "application/json",
"X-ApiKey": "{MERCHANT_API_KEY}",
"Authorization": "Bearer {JWT_TOKEN}"
}
{
"orderId": 12345,
"channelId": "{CHANNEL_ID}",
"languageId": "{LANGUAGE_ID}",
"marketId": "{MARKET_ID}"
}
curl -X POST https://merchantapi.geins.io/graphql \
-H "Accept: application/json" \
-H "X-ApiKey: {MERCHANT_API_KEY}" \
-H "Authorization: Bearer {JWT_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"query":"query getOrder($orderId:Int!,$channelId:String,$languageId:String,$marketId:String){getOrder(orderId:$orderId,channelId:$channelId,languageId:$languageId,marketId:$marketId){id publicId createdAt completedAt status orderTotal{sellingPriceIncVat sellingPriceExVat vat} shippingAddress{firstName lastName company addressLine1 city zip country} paymentDetails{displayName} shippingDetails{name parcelNumber trackingLink}}}","variables":{"orderId":12345,"channelId":"{CHANNEL_ID}","languageId":"{LANGUAGE_ID}","marketId":"{MARKET_ID}"}}'
Response example
200 OK{
"data": {
"getOrder": {
"id": 12345,
"publicId": "ORD-2025-001234",
"createdAt": "2025-10-25T14:30:00Z",
"completedAt": "2025-10-27T09:00:00Z",
"status": "Shipped",
"orderTotal": {
"sellingPriceIncVat": 4500.00,
"sellingPriceExVat": 3600.00,
"vat": 900.00
},
"shippingAddress": {
"firstName": "Anna",
"lastName": "Svensson",
"company": "Acme Trading AB",
"addressLine1": "Industrivägen 10",
"city": "Stockholm",
"zip": "11122",
"country": "SE"
},
"paymentDetails": {
"displayName": "Invoice"
},
"shippingDetails": {
"name": "Standard Shipping",
"parcelNumber": "TRK987654321SE",
"trackingLink": "https://tracking.example.com/TRK987654321SE"
}
}
}
}
Options
Multi-market support
All queries support optional parameters for multi-market functionality:
channelId: Target specific sales channelslanguageId: Set content languagemarketId: Target specific markets
Authenticated access
Authentication is required for this endpoint. The getCompanyOrders query uses the JWT bearer token to identify the user's company membership and retrieve all orders placed under that company. Without a valid token the request will fail with an authorization error.
Include the token in the Authorization header:
Authorization: Bearer {JWT_TOKEN}
Common pitfalls
- Confusing
getCompanyOrderswithgetOrders—getOrdersreturns only the individual user's orders.getCompanyOrdersreturns orders placed by all buyers in the company. Use Get user orders for personal order history. - User not linked to a company — If the authenticated user has no company account, the query returns an empty list rather than an error.
- Missing JWT token — This query requires authentication. An API key alone is not sufficient; include the
Authorization: Bearerheader.