Skip to content

Protocols

Each Appwrite project exposes its API through three protocols: REST, GraphQL, and WebSocket. You can disable any protocol your clients don't use to shrink the project's surface area, then re-enable it when needed.

Protocols can be toggled from the Appwrite Console, or programmatically through any server SDK using the Project service.

Manage from the Console

Project protocols in the Appwrite Console

Project protocols in the Appwrite Console

To toggle a protocol manually:

  1. Open your project in the Appwrite Console.
  2. Open Settings from the bottom of the side nav.
  3. Scroll to the Protocols card.
  4. Flip the switch next to REST, GraphQL, or WebSocket. Use Disable all to turn off every protocol at once.

Available protocols

Protocol IDDescription
rest
Standard HTTP API requests from client SDKs.
graphql
GraphQL API access for queries and mutations.
websocket
Realtime subscriptions over WebSocket connections.

Update a protocol

The example below disables the REST protocol. Pass enabled: true to re-enable it.

Disabling REST blocks client SDK traffic only. Server SDKs using an API key keep access, so you can always call this endpoint again to re-enable the protocol.

Required scope

The API key used for this call needs the project.write scope.

import { Client, Project, ProjectProtocolId } from 'node-appwrite';

const client = new Client()
    .setEndpoint('https://<REGION>.cloud.appwrite.io/v1')
    .setProject('<PROJECT_ID>')
    .setKey('<YOUR_API_KEY>');

const project = new Project(client);

const result = await project.updateProtocol({
    protocolId: ProjectProtocolId.Rest,
    enabled: false
});

Benefits

  • Shrink the client surface area. Disabled protocols are blocked for client SDK callers (anonymous, account session, JWT, and OAuth users). Server SDKs using an API key still have access, including to re-enable the protocol.
  • Repeatable provisioning. Script the protocol set a project should expose and apply it from CI when spinning up a new environment.
  • Environment parity. Keep dev, staging, and production in sync by running the same enable/disable script against each project.