Manage organizations using the Neon API
Learn how to manage Neon Organizations using the Neon API, including managing organization API keys, working with organization members, and handling member invitations.
Personal vs organization API keys
You can authorize your API requests using either of these methods:
- Organization API key: Automatically scopes all requests to your organization
- Personal API key: Requires including an
org_id
parameter to specify which organization you're working with
The key difference is in how you structure your API requests. Here's an example of listing projects using both methods:
Using an organization API key:
Using a personal API key:
Both examples retrieve a list of projects, but notice how the personal API key request includes org_id=org-example-12345678
to specify which organization's projects to list. With an organization API key, this parameter isn't needed because the key itself is already tied to a specific organization.
Matrix of operations and key types
Some operations require a personal API key from an organization admin and cannot be performed using organization API keys. These operations are marked with ❌ in the matrix below.
Finding your org_id
To find your organization's org_id
, navigate to your Organization's Settings page, where you'll find it under the General information section. Copy and use this ID in your API requests.
Create API keys
There are two types of organization API keys:
- Organization API keys — These keys provide admin-level access to all organization resources, including projects, members, and settings
- Project-scoped organization API keys — These keys provide limited, member-level access to specific projects within the organization
Only organization admins can create these keys, and the key token is only displayed once at creation time. For detailed instructions, see Manage API Keys.
List API keys
Lists all API keys for your organization. The response does not include the actual key tokens, as these are only provided when creating a new key.
Example response:
Revoke an API key
Revokes the specified organization API key. This action cannot be reversed. You can obtain the key_id
by listing the API keys for your organization.
Example response:
Get organization details
Retrieves information about your organization, including its name, plan, and creation date.
Example response:
List members
Lists all members in your organization. Each entry includes:
- Member ID (
id
): The unique identifier for the member - User ID (
user_id
): The unique ID of the user's Neon account - Organization role and join date
- User's email address
Example response:
note
id
) from this response is needed for operations like updating roles or removing members.Get member details
Retrieves information about a specific member using their member ID (obtained from the Get all members endpoint).
Example response:
Update member role
Changes a member's current role in the organization. If using your personal API key, you need to be an admin in the organization to perform this action. Note: you cannot downgrade the role of the organization's only admin.
Example response:
Remove member
You must use your personal API key and have admin-level permissions in the organization to use this endpoint. Organization API keys are not supported.
List invitations
Retrieves a list of all pending invitations for the organization.
Example response:
Create invitations
Creates invitations for new organization members. Each invited user:
- Receives an email notification about the invitation
- If they have an existing Neon account, they automatically join as a member
- If they don't have an account yet, the email invites them to create one
You must use your personal API key and have admin-level permissions in the organization to use this endpoint. Organization API keys are not supported.