Skip to content
Back

Server API Key

  • 0
  • 2
  • Self Hosted
  • Web
Sergio
8 Nov, 2025, 14:57

Hi, I have a self-hosted Appwrite instance and I can’t quite figure out how to create a server-side API that lets me automate the creation of projects. The only API key I’ve seen is the one that allows access to specific projects, but I need a more general one. Maybe it’s a configuration variable to set in the .env file. Thanks for the help.

TL;DR
To use a server API key in your code with the Appwrite API, set up a console session using the provided code snippet. Make sure to include the correct email and password in the session creation. Remember to add the session cookie to your headers for subsequent API calls.
9 Nov, 2025, 17:34

Hello, any help?

10 Nov, 2025, 03:36

you can setup a console session

10 Nov, 2025, 03:38
TypeScript
const session = await axios.post(
      endpoint + accountPath,
      {
        email: <email>,
        password: <password>,
      },
      {
        headers: {
          'content-type': 'application/json',
          'X-Appwrite-Project': 'console',
        },
      }
    );

const sessionCookie = session.headers['set-cookie'][0];

// now make any call using:
// headers: {
//          'content-type': 'application/json',
//          'X-Appwrite-Project': 'console',
//          Cookie: sessionCookie,
// },
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more