How to retrieve company information using ID or slug with the Blue API.


To retrieve company information, you can use the company query with either the company ID or slug:

Query by Company ID

query GetCompanyById {
  company(id: "company-id-here") {
    id
    name
    slug
    createdAt
    updatedAt
  }
}

Query by Company Slug

The same query also accepts a company slug, making it easy to retrieve company information using the URL-friendly identifier:

query GetCompanyBySlug {
  company(id: "company-slug-here") {
    id
    name
    slug
    createdAt
    updatedAt
  }
}

Response Example

Both queries will return the same company object:

{
  "data": {
    "company": {
      "id": "cuid123456789",
      "name": "Acme Corporation",
      "slug": "acme-corp",
      "createdAt": "2024-01-15T10:30:00.000Z",
      "updatedAt": "2024-03-20T14:45:00.000Z"
    }
  }
}

Important Notes

  • The id parameter accepts both company IDs and slugs
  • Only companies where the current user is a member will be returned
  • If the company is not found or the user doesn't have access, a CompanyNotFoundError will be thrown
  • Banned companies will throw a CompanyBannedError

Available Fields

You can query for additional company fields as needed:

query GetCompanyDetails {
  company(id: "company-slug") {
    id
    name
    slug
    # Add more fields as needed based on your requirements
    # Check the GraphQL schema for all available fields
  }
}

AI Assistant

Responses are generated using AI and may contain mistakes.

How can I help you?

Ask me anything about Blue or this documentation.

Enter to send • Shift+Enter for new line • ⌘I to open