Squirro API#

Warning

Project Neo is currently in Technical Preview. Features described in this section may change before general availability.

Your dashboards can fetch data from the Squirro API using standard fetch calls. Authentication is handled automatically. No manual token management is required.

How Authentication Works#

  • During local development

    The dev proxy injects a valid access token into all API requests on your behalf.

  • In production

    The webclient server handles authentication via session cookies on the same origin.

The same fetch paths work in both environments. No code changes are needed when deploying.

Note

The Squirro API uses a refresh token and access token model. In extensions, that exchange is handled automatically. You never interact with tokens directly. For background on how Squirro authentication works, see the Authentication page.

Data Fetching with React Query#

Use @tanstack/react-query for data fetching. It handles caching, loading states, and error states:

import { useQuery } from '@tanstack/react-query';

interface Props {
  projectId: string;
}

export default function Analytics({ projectId }: Props) {
  const { data, isLoading, error } = useQuery({
    queryKey: ['my-data', projectId],
    queryFn: async () => {
      const response = await fetch(`/api/your-endpoint?project_id=${encodeURIComponent(projectId)}`);
      if (!response.ok) throw new Error('Request failed');
      return response.json();
    },
  });

  if (isLoading) return <div>Loading...</div>;
  if (error) return <div>Error loading data</div>;

  return <div>{JSON.stringify(data)}</div>;
}

Tip

Always include projectId in your query keys. When you switch projects, React Query automatically refetches with the new project ID.

API Documentation#

The Squirro platform exposes its functionality through a set of REST APIs. The following references cover the available endpoints, request formats, and response schemas: