Stream Users API

Upsert, query, update, deactivate, and reactivate users.

OpenAPI Specification

getstream-users-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Stream Chat API (Server-side REST) Application Users API
  description: 'Server-side REST API for Stream (GetStream.io) Chat. This is a curated subset of Stream''s published Chat protocol (https://getstream.github.io/protocol), grounding the endpoints modeled in the API Evangelist catalog against the real base URL and paths. The Chat API is addressed at https://chat.stream-io-api.com. Every request carries the application `api_key` as a query parameter and is authenticated with a JWT sent in the `Authorization` header together with a `Stream-Auth-Type: jwt` header. Server-side tokens (no `user_id` claim) are used for the operations in this document; client tokens are used to open the real-time WebSocket connection modeled in the companion AsyncAPI document.

    Path and method choices here are taken from Stream''s official chat-openapi.yaml (github.com/GetStream/protocol). Request and response bodies are represented generically; consult the linked protocol reference for the full schemas.'
  version: '1.0'
  contact:
    name: API Evangelist
    url: https://apievangelist.com
    email: kin@apievangelist.com
  license:
    name: API documentation - Stream Terms
    url: https://getstream.io/legal/terms/
servers:
- url: https://chat.stream-io-api.com
  description: Stream Chat API (edge, global)
security:
- JWT: []
  ApiKey: []
tags:
- name: Users
  description: Upsert, query, update, deactivate, and reactivate users.
paths:
  /users:
    get:
      operationId: QueryUsers
      tags:
      - Users
      summary: Query users
      description: Query users with filtering, sorting, and pagination.
      parameters:
      - name: payload
        in: query
        description: URL-encoded JSON query (filter_conditions, sort, limit, offset).
        schema:
          type: string
      responses:
        '200':
          description: A list of users.
          content:
            application/json:
              schema:
                type: object
                properties:
                  users:
                    type: array
                    items:
                      $ref: '#/components/schemas/User'
    post:
      operationId: UpsertUsers
      tags:
      - Users
      summary: Upsert users
      description: Create or update a batch of users by id.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                users:
                  type: object
                  additionalProperties:
                    $ref: '#/components/schemas/User'
      responses:
        '201':
          description: The upserted users keyed by id.
          content:
            application/json:
              schema:
                type: object
        '429':
          $ref: '#/components/responses/TooManyRequests'
    patch:
      operationId: UpdateUsersPartial
      tags:
      - Users
      summary: Partially update users
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                users:
                  type: array
                  items:
                    type: object
      responses:
        '200':
          description: The updated users.
          content:
            application/json:
              schema:
                type: object
  /users/{user_id}/deactivate:
    parameters:
    - name: user_id
      in: path
      required: true
      schema:
        type: string
    post:
      operationId: DeactivateUser
      tags:
      - Users
      summary: Deactivate a user
      description: Deactivate a user, preventing them from connecting or sending messages.
      responses:
        '200':
          description: The deactivated user.
          content:
            application/json:
              schema:
                type: object
components:
  schemas:
    User:
      type: object
      properties:
        id:
          type: string
        role:
          type: string
        name:
          type: string
        image:
          type: string
        online:
          type: boolean
        last_active:
          type: string
          format: date-time
        created_at:
          type: string
          format: date-time
    APIError:
      type: object
      properties:
        code:
          type: integer
        message:
          type: string
        StatusCode:
          type: integer
        duration:
          type: string
        more_info:
          type: string
  responses:
    TooManyRequests:
      description: Rate limit exceeded for this app, platform, and endpoint. Inspect the X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset headers.
      headers:
        X-RateLimit-Limit:
          schema:
            type: integer
        X-RateLimit-Remaining:
          schema:
            type: integer
        X-RateLimit-Reset:
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/APIError'
  securitySchemes:
    JWT:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'A Stream JWT sent in the `Authorization` header. Server-side tokens omit the `user_id` claim; a `Stream-Auth-Type: jwt` header must accompany the request.'
    ApiKey:
      type: apiKey
      in: query
      name: api_key
      description: The application API key, sent as the `api_key` query parameter on every request.