Skip to main content

Client Queries

Queries for retrieving client information and their associated brands.

client

Retrieves a single client by ID.

Arguments

type ClientArgs {
"""
ID of the client to retrieve.
"""
id: Int!
}

Response

type Client {
"""
Unique identifier for the client.
"""
id: Int!

"""
Name of the client.
"""
name: String!

"""
Optional logo URL.
"""
logo: String

"""
List of brands associated with this client.
"""
brands: [Brand!]!
}

Example Query

query GetClient {
client(id: 123) {
id
name
logo
brands {
id
name
}
}
}

clients

Retrieves all clients the authenticated user has access to.

Response

Returns an array of Client objects.

Example Query

query GetClients {
clients {
id
name
logo
brands {
id
name
}
}
}

Error Handling

Common Errors

Error CodeDescription
CLIENT_NOT_FOUNDClient ID not found
PERMISSION_DENIEDNot authorized to view client

Example Error Response

{
"errors": [
{
"message": "Client not found",
"extensions": {
"code": "CLIENT_NOT_FOUND",
"clientId": "123"
}
}
]
}

Best Practices

  1. Authentication

    • Always include valid JWT with client_list claim
    • Handle token expiration gracefully
  2. Performance

    • Request only needed fields
    • Consider caching strategies
  3. Security

    • Validate client access
    • Implement rate limiting
    • Audit sensitive queries
  4. Error Handling

    • Handle all error cases gracefully
    • Provide meaningful error messages to users