© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•2mo ago•
6 replies
Xavier A

Get Typescript Types from Management API with Legacy Keys Disabled?

🟡javascript
Hello 👋
Following Supabase for Platforms announcement, I was delighted to figure out that we can now fetch Typescript types programmatically from the Management API.
But, it looks like it does not work if the target project has moved to the new API Keys, which is weird since the Management API seems a bit unrelated to the Data API from my perspective.

I get an error :


{
  "message": "{\"message\":\"Legacy API keys are disabled\",\"hint\":\"Your legacy API keys (anon, service_role) were disabled on 2025-11-13T10:41:23.346309+00:00. Re-enable them in the Supabase dashboard, or use the new publishable and secret API keys.\"}"
}

{
  "message": "{\"message\":\"Legacy API keys are disabled\",\"hint\":\"Your legacy API keys (anon, service_role) were disabled on 2025-11-13T10:41:23.346309+00:00. Re-enable them in the Supabase dashboard, or use the new publishable and secret API keys.\"}"
}


Code snippet:


    console.log(`:satellite: Fetching TypeScript types for project: ${supabaseHosting.project_id}`);

    // Step 3: Get Management API token from environment
    const managementApiToken = process.env.SUPABASE_MANAGEMENT_API_TOKEN;
    if (!managementApiToken) {
      throw new Error('SUPABASE_MANAGEMENT_API_TOKEN environment variable is required');
    }

    // Step 4: Call Supabase Management API to fetch TypeScript types
    const response = await fetch(
      `${MANAGEMENT_BASE}/projects/${supabaseHosting.project_id}/types/typescript`,
      {
        method: 'GET',
        headers: {
          'Authorization': `Bearer ${managementApiToken}`,
          'Content-Type': 'application/json',
        },
      }
    );

    if (!response.ok) {
      const errorText = await response.text();
      throw new Error(`Management API request failed: ${response.status} ${response.statusText}. ${errorText}`);
    }
    console.log(`:satellite: Fetching TypeScript types for project: ${supabaseHosting.project_id}`);

    // Step 3: Get Management API token from environment
    const managementApiToken = process.env.SUPABASE_MANAGEMENT_API_TOKEN;
    if (!managementApiToken) {
      throw new Error('SUPABASE_MANAGEMENT_API_TOKEN environment variable is required');
    }

    // Step 4: Call Supabase Management API to fetch TypeScript types
    const response = await fetch(
      `${MANAGEMENT_BASE}/projects/${supabaseHosting.project_id}/types/typescript`,
      {
        method: 'GET',
        headers: {
          'Authorization': `Bearer ${managementApiToken}`,
          'Content-Type': 'application/json',
        },
      }
    );

    if (!response.ok) {
      const errorText = await response.text();
      throw new Error(`Management API request failed: ${response.status} ${response.statusText}. ${errorText}`);
    }




With the exact same project, I can apply migrations from the Management API without any troubles.
Management API Reference | Supabase Docs
Management API reference for the Supabase API
Management API Reference | Supabase Docs
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Legacy api keys used even if disabled?
SupabaseSSupabase / help-and-questions
4mo ago
Asymmetric Keys and Management API
SupabaseSSupabase / help-and-questions
7mo ago
Can't rotate to new API keys - JS client fails when legacy keys disabled
SupabaseSSupabase / help-and-questions
2mo ago
New Publishable API Keys vs. Legacy Anon Key
SupabaseSSupabase / help-and-questions
6mo ago