Xata Organizations API

Operations for creating, retrieving, updating, and deleting organizations

OpenAPI Specification

xata-organizations-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: Xata API Keys Organizations API
  description: Xata API
  version: '1.0'
  contact:
    name: help@xata.io
servers:
- url: https://api.xata.tech
  description: Xata API
tags:
- name: Organizations
  description: Operations for creating, retrieving, updating, and deleting organizations
  x-displayName: Organizations
paths:
  /organizations:
    summary: Organizations Management
    description: This endpoint enables creating and listing organizations within Xata. Organizations are the top-level entity that contains projects, branches, and team members.
    get:
      operationId: getOrganizationsList
      summary: Get list of organizations
      description: Retrieve the list of all organizations the authenticated user belongs to, including their IDs and names. This endpoint allows users to view all organizations they have access to.
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  organizations:
                    description: List of organizations the user has access to
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          description: Unique identifier for the organization
                          $ref: '#/components/schemas/OrganizationID'
                        name:
                          description: Human-readable name of the organization
                          type: string
                        status:
                          description: Current status of the organization
                          $ref: '#/components/schemas/OrganizationStatus'
                      required:
                      - id
                      - name
                      - status
                required:
                - organizations
        '400':
          $ref: '#/components/responses/BadRequestError'
        '401':
          $ref: '#/components/responses/AuthError'
        '404':
          $ref: '#/components/responses/SimpleError'
        5XX:
          description: Unexpected Error
      security:
      - xata:
        - org:read
      tags:
      - Organizations
    post:
      operationId: createOrganization
      summary: Create a new organization
      description: Creates a new organization with the authenticated user as its single owner.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateOrganizationRequest'
      responses:
        '201':
          description: Organization successfully created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Organization'
        '400':
          $ref: '#/components/responses/BadRequestError'
        '401':
          $ref: '#/components/responses/AuthError'
        '404':
          $ref: '#/components/responses/SimpleError'
        5XX:
          description: Unexpected Error
      security:
      - xata:
        - org:write
      tags:
      - Organizations
  /organizations/{organizationID}:
    summary: Organization Operations
    description: This endpoint provides operations for a specific organization, allowing retrieval, updating, and deletion of an organization by its unique identifier.
    parameters:
    - $ref: '#/components/parameters/OrganizationIDParam'
    get:
      operationId: getOrganization
      summary: Get organization details
      description: Retrieve detailed information about a specific organization by its ID.
      responses:
        '200':
          description: Organization details retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Organization'
        '400':
          $ref: '#/components/responses/BadRequestError'
        '401':
          $ref: '#/components/responses/AuthError'
        '403':
          $ref: '#/components/responses/AuthError'
        '404':
          $ref: '#/components/responses/SimpleError'
        5XX:
          description: Unexpected Error
      security:
      - xata:
        - org:read
      tags:
      - Organizations
    put:
      operationId: updateOrganization
      summary: Update organization details
      description: Update information for an existing organization, such as its name.
      requestBody:
        content:
          application/json:
            schema:
              properties:
                id:
                  description: Unique identifier for the organization to update
                  $ref: '#/components/schemas/OrganizationID'
                name:
                  description: New name for the organization
                  type: string
      responses:
        '200':
          description: Organization successfully updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Organization'
        '400':
          $ref: '#/components/responses/BadRequestError'
        '401':
          $ref: '#/components/responses/AuthError'
        '403':
          $ref: '#/components/responses/AuthError'
        '404':
          $ref: '#/components/responses/SimpleError'
        5XX:
          description: Unexpected Error
      security:
      - xata:
        - org:write
      tags:
      - Organizations
    delete:
      operationId: deleteOrganization
      summary: Delete an organization
      description: '[Not implemented yet] Permanently delete an organization. This action cannot be undone.'
      responses:
        '204':
          description: Organization successfully deleted
        '400':
          $ref: '#/components/responses/BadRequestError'
        '401':
          $ref: '#/components/responses/AuthError'
        '403':
          $ref: '#/components/responses/AuthError'
        '404':
          $ref: '#/components/responses/SimpleError'
        5XX:
          description: Unexpected Error
      security:
      - xata:
        - org:write
      tags:
      - Organizations
  /organizations/{organizationID}/members:
    get:
      operationId: listOrganizationMembers
      summary: List members of an organization
      parameters:
      - $ref: '#/components/parameters/OrganizationIDParam'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  members:
                    type: array
                    items:
                      $ref: '#/components/schemas/UserWithID'
                required:
                - members
      security:
      - xata:
        - org:read
      tags:
      - Organizations
  /organizations/{organizationID}/members/{userID}:
    delete:
      operationId: removeOrganizationMember
      summary: Remove a member from an organization
      parameters:
      - $ref: '#/components/parameters/OrganizationIDParam'
      - $ref: '#/components/parameters/UserIDParam'
      responses:
        '204':
          description: Member removed
      security:
      - xata:
        - org:write
      tags:
      - Organizations
  /organizations/{organizationID}/invitations:
    get:
      operationId: listOrganizationInvitations
      summary: List invitations for an organization
      description: Retrieve all invitations for an organization with optional filtering by status, email, and name.
      parameters:
      - $ref: '#/components/parameters/OrganizationIDParam'
      - name: status
        in: query
        description: Filter invitations by status
        schema:
          type: string
          enum:
          - pending
          - expired
      - name: email
        in: query
        description: Filter invitations by email address
        schema:
          type: string
      - name: first_name
        in: query
        description: Filter invitations by first name
        schema:
          type: string
      - name: last_name
        in: query
        description: Filter invitations by last name
        schema:
          type: string
      - name: search
        in: query
        description: Search invitations by email or name
        schema:
          type: string
      - name: first
        in: query
        description: Index of the first result to return (0-based offset for pagination)
        schema:
          type: integer
          default: 0
          minimum: 0
      - name: max
        in: query
        description: Maximum number of results to return
        schema:
          type: integer
          default: 100
          maximum: 100
          minimum: 1
      responses:
        '200':
          description: List of invitations retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  invitations:
                    type: array
                    items:
                      $ref: '#/components/schemas/OrganizationInvitation'
                required:
                - invitations
        '400':
          $ref: '#/components/responses/BadRequestError'
        '401':
          $ref: '#/components/responses/AuthError'
        '403':
          $ref: '#/components/responses/AuthError'
        '404':
          $ref: '#/components/responses/SimpleError'
        5XX:
          description: Unexpected Error
      security:
      - xata:
        - invite:read
      tags:
      - Organizations
    post:
      operationId: createOrganizationInvitation
      summary: Send an invitation to join an organization
      description: Send an invitation email to a user to join an organization.
      parameters:
      - $ref: '#/components/parameters/OrganizationIDParam'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateOrganizationInvitationRequest'
      responses:
        '201':
          description: Invitation sent successfully
        '400':
          $ref: '#/components/responses/BadRequestError'
        '401':
          $ref: '#/components/responses/AuthError'
        '403':
          $ref: '#/components/responses/AuthError'
        '404':
          $ref: '#/components/responses/SimpleError'
        '409':
          $ref: '#/components/responses/SimpleError'
        5XX:
          description: Unexpected Error
      security:
      - xata:
        - invite:write
      tags:
      - Organizations
  /organizations/{organizationID}/invitations/{invitationID}:
    get:
      operationId: getOrganizationInvitation
      summary: Get details of a specific invitation
      description: Retrieve detailed information about a specific invitation by its ID.
      parameters:
      - $ref: '#/components/parameters/OrganizationIDParam'
      - $ref: '#/components/parameters/InvitationIDParam'
      responses:
        '200':
          description: Invitation details retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrganizationInvitation'
        '400':
          $ref: '#/components/responses/BadRequestError'
        '401':
          $ref: '#/components/responses/AuthError'
        '403':
          $ref: '#/components/responses/AuthError'
        '404':
          $ref: '#/components/responses/SimpleError'
        5XX:
          description: Unexpected Error
      security:
      - xata:
        - invite:read
      tags:
      - Organizations
    delete:
      operationId: deleteOrganizationInvitation
      summary: Delete an invitation
      description: Permanently delete an invitation record.
      parameters:
      - $ref: '#/components/parameters/OrganizationIDParam'
      - $ref: '#/components/parameters/InvitationIDParam'
      responses:
        '204':
          description: Invitation deleted successfully
        '400':
          $ref: '#/components/responses/BadRequestError'
        '401':
          $ref: '#/components/responses/AuthError'
        '403':
          $ref: '#/components/responses/AuthError'
        '404':
          $ref: '#/components/responses/SimpleError'
        5XX:
          description: Unexpected Error
      security:
      - xata:
        - invite:write
      tags:
      - Organizations
  /organizations/{organizationID}/invitations/{invitationID}/resend:
    post:
      operationId: resendOrganizationInvitation
      summary: Resend an invitation
      description: Resend a pending invitation with a fresh expiration time.
      parameters:
      - $ref: '#/components/parameters/OrganizationIDParam'
      - $ref: '#/components/parameters/InvitationIDParam'
      responses:
        '204':
          description: Invitation resent successfully
        '400':
          $ref: '#/components/responses/BadRequestError'
        '401':
          $ref: '#/components/responses/AuthError'
        '403':
          $ref: '#/components/responses/AuthError'
        '404':
          $ref: '#/components/responses/SimpleError'
        5XX:
          description: Unexpected Error
      security:
      - xata:
        - invite:write
      tags:
      - Organizations
  /organizations/{organizationID}/deletion-request:
    post:
      operationId: requestOrganizationDeletion
      summary: Request organization deletion
      description: 'Flags the organization for deletion. The request is rejected if the organization still has active projects.

        The subscription is cancelled immediately and any outstanding invoices are collected automatically after a grace period that prevents missing delayed usage reports.

        Deletion completes asynchronously once all invoices are issued and settled.

        '
      parameters:
      - $ref: '#/components/parameters/OrganizationIDParam'
      responses:
        '202':
          description: Deletion requested — the organization will be removed once all outstanding invoices are settled
        '400':
          $ref: '#/components/responses/BadRequestError'
        '401':
          $ref: '#/components/responses/AuthError'
        '403':
          $ref: '#/components/responses/AuthError'
        '409':
          $ref: '#/components/responses/SimpleError'
        5XX:
          description: Unexpected Error
      security:
      - xata:
        - org:write
      tags:
      - Organizations
  /organizations/{organizationID}/membership-limits:
    get:
      operationId: getOrganizationMembershipLimits
      summary: Get organization membership limits
      description: Retrieves the membership limits for the specified organization (maximum members and invitations).
      parameters:
      - $ref: '#/components/parameters/OrganizationIDParam'
      responses:
        '200':
          description: Membership limits for the organization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrganizationMembershipLimits'
        '401':
          $ref: '#/components/responses/AuthError'
        '403':
          $ref: '#/components/responses/AuthError'
        5XX:
          description: Unexpected Error
      security:
      - xata:
        - org:read
      tags:
      - Organizations
components:
  schemas:
    CreateOrganizationInvitationRequest:
      type: object
      properties:
        email:
          description: Email address of the user to invite
          type: string
          format: email
      required:
      - email
    CreateOrganizationRequest:
      description: Request payload for creating a new organization
      type: object
      properties:
        name:
          description: Name for the new organization
          type: string
      required:
      - name
    UserID:
      description: Unique identifier for a user account
      type: string
      pattern: '[a-zA-Z0-9_-~:]+'
      title: UserID
      x-oapi-codegen-extra-tags:
        validate: identifier
    UserWithID:
      allOf:
      - $ref: '#/components/schemas/User'
      - type: object
        description: Extended user object that includes the unique user identifier
        properties:
          id:
            $ref: '#/components/schemas/UserID'
        required:
        - id
    OrganizationMembershipLimits:
      description: Membership limits for an organization
      type: object
      properties:
        maxMembers:
          description: Maximum number of members allowed in the organization
          type: integer
          minimum: 1
          title: Maximum number of organization members
        maxInvites:
          description: Maximum number of pending invitations allowed at once
          type: integer
          minimum: 1
          title: Maximum number of pending invitations
      required:
      - maxMembers
      - maxInvites
    OrganizationInvitation:
      type: object
      properties:
        id:
          description: Unique identifier for the invitation
          type: string
        organization_id:
          description: ID of the organization the invitation is for
          $ref: '#/components/schemas/OrganizationID'
        email:
          description: Email address of the invited user
          type: string
          format: email
        first_name:
          description: First name of the invited user
          type: string
          nullable: true
        last_name:
          description: Last name of the invited user
          type: string
          nullable: true
        created_at:
          description: Timestamp when the invitation was created
          type: string
          format: date-time
        expires_at:
          description: Timestamp when the invitation expires
          type: string
          format: date-time
        status:
          description: Current status of the invitation
          type: string
          enum:
          - pending
          - expired
        invite_link:
          description: URL link to accept the invitation
          type: string
      required:
      - id
      - organization_id
      - email
      - created_at
      - expires_at
      - status
    OrganizationID:
      title: OrganizationID
      type: string
      pattern: '[a-zA-Z0-9_-~:]+'
      x-oapi-codegen-extra-tags:
        validate: identifier
    OrganizationStatus:
      type: object
      properties:
        status:
          description: Indicates whether the organization is active, it's computed as `!disabled_by_admin AND billing_status == 'ok'`
          type: string
          enum:
          - enabled
          - disabled
        disabled_by_admin:
          description: Indicates if the organization has been disabled by an admin
          type: boolean
        admin_reason:
          description: Reason for the current admin status
          type: string
        billing_status:
          description: Indicates the status of the organization from a billing perspective
          type: string
          enum:
          - ok
          - no_payment_method
          - invoice_overdue
          - unknown
          - deletion_requested
        billing_reason:
          description: Reason for the current billing status
          type: string
        usage_tier:
          description: Usage tier of the organization. t1 is the default for new organizations, t2 is assigned when a valid payment method is on file.
          type: string
          enum:
          - t1
          - t2
        last_updated:
          description: Timestamp of the last update to the organization's status
          type: string
          format: date-time
        created_at:
          description: Timestamp when the organization was created
          type: string
          format: date-time
      required:
      - status
      - disabled_by_admin
      - billing_status
      - usage_tier
      - last_updated
    Organization:
      description: Organization details including ID and name
      type: object
      properties:
        id:
          description: Unique identifier for the organization
          $ref: '#/components/schemas/OrganizationID'
        name:
          description: Human-readable name of the organization
          type: string
        status:
          description: Current status of the organization
          $ref: '#/components/schemas/OrganizationStatus'
        marketplace:
          description: Marketplace provider for this organization (e.g. "aws"), if billed through a marketplace
          type: string
          nullable: true
      required:
      - id
      - name
      - status
    User:
      description: User information including email, full name, and profile image
      type: object
      properties:
        email:
          description: Email address associated with the user account
          type: string
          format: email
        name:
          description: Name of the user
          type: string
      required:
      - name
      - email
  parameters:
    UserIDParam:
      name: userID
      in: path
      required: true
      schema:
        $ref: '#/components/schemas/UserID'
      description: Unique identifier for a specific user account
    OrganizationIDParam:
      name: organizationID
      in: path
      required: true
      schema:
        $ref: '#/components/schemas/OrganizationID'
      description: Unique identifier for a specific organization
    InvitationIDParam:
      name: invitationID
      in: path
      required: true
      schema:
        type: string
      description: Unique identifier for an invitation
  responses:
    AuthError:
      description: Error returned when authentication or authorization fails
      content:
        application/json:
          schema:
            type: object
            properties:
              id:
                description: Error identifier for tracking and debugging
                type: string
              message:
                description: Human-readable error message explaining the issue
                type: string
            example:
              message: invalid API key
            required:
            - message
    BadRequestError:
      description: Error returned when the request is malformed or contains invalid parameters
      content:
        application/json:
          schema:
            type: object
            properties:
              id:
                description: Error identifier for tracking and debugging
                type: string
              message:
                description: Human-readable error message explaining the issue
                type: string
            required:
            - message
    SimpleError:
      description: Generic error response
      content:
        application/json:
          schema:
            type: object
            properties:
              id:
                description: Error identifier for tracking and debugging
                type: string
              message:
                description: Human-readable error message explaining the issue
                type: string
            required:
            - message
  securitySchemes:
    oidc:
      type: openIdConnect
      openIdConnectUrl: https://auth.xata.io/realms/xata/.well-known/openid-configuration
    apiKey:
      type: apiKey
      in: header
      name: Authorization
      description: 'API key authentication using Bearer token format: Bearer <api_key>'
    xata:
      type: oauth2
      flows:
        implicit:
          authorizationUrl: https://auth.xata.io/realms/xata/protocol/openid-connect/auth
          scopes:
            org:read: Read organization information
            org:write: Create and modify organizations
            keys:read: Read API keys
            keys:write: Create and manage API keys
            project:read: Read project information
            project:write: Create and modify projects
            branch:read: Read branch information
            branch:write: Create and modify branches
            metrics:read: Read metrics data
            logs:read: Read logs data
            credentials:read: Read credentials
            credentials:write: Rotate credentials
            marketplace:write: Register with cloud marketplaces
    branchConnectionString:
      type: apiKey
      in: header
      name: Connection-String
      description: Branch PostgreSQL connection string (`postgres://user:pass@{branch}.{region}.xata.tech/db`), including the embedded password. The hostname selects the target branch, region, and endpoint type (the `-rw`/`-ro` suffix, see `EndpointType`), and must match the request host. Obtain it from the Xata dashboard or the control-plane API. This is the only credential the gateway accepts; the control-plane API key (Bearer token) is rejected here. For the WebSocket endpoint (`GET /v2`) the same connection string is conveyed via the PostgreSQL startup message instead of this header.
externalDocs:
  url: https://xata.io/docs/api
x-tagGroups:
- name: Authentication API
  tags:
  - Organizations
  - Users
  - API Keys
  - Marketplace
  - Billing
  - Webhooks
- name: Gateway API
  tags:
  - Gateway
- name: Projects API
  tags:
  - Projects Webhooks
  - Projects
  - Branches
  - GitHub App
  - Metrics
  - Logs