Svix Stream Authentication API

The Stream Authentication API from Svix — 5 operation(s) for stream authentication.

OpenAPI Specification

svix-stream-authentication-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Svix Application Stream Authentication API
  description: 'Welcome to the Svix API documentation!


    Useful links: [Homepage](https://www.svix.com) | [Support email](mailto:support+docs@svix.com) | [Blog](https://www.svix.com/blog/) | [Slack Community](https://www.svix.com/slack/)


    # Introduction


    This is the reference documentation and schemas for the [Svix webhook service](https://www.svix.com) API. For tutorials and other documentation please refer to [the documentation](https://docs.svix.com).


    ## Main concepts


    In Svix you have four important entities you will be interacting with:


    - `messages`: these are the webhooks being sent. They can have contents and a few other properties.

    - `application`: this is where `messages` are sent to. Usually you want to create one application for each user on your platform.

    - `endpoint`: endpoints are the URLs messages will be sent to. Each application can have multiple `endpoints` and each message sent to that application will be sent to all of them (unless they are not subscribed to the sent event type).

    - `event-type`: event types are identifiers denoting the type of the message being sent. Event types are primarily used to decide which events are sent to which endpoint.



    ## Authentication


    Get your authentication token (`AUTH_TOKEN`) from the [Svix dashboard](https://dashboard.svix.com) and use it as part of the `Authorization` header as such: `Authorization: Bearer ${AUTH_TOKEN}`. For more information on authentication, please refer to the [authentication token docs](https://docs.svix.com/api-keys).


    <SecurityDefinitions />



    ## Code samples


    The code samples assume you already have the respective libraries installed and you know how to use them. For the latest information on how to do that, please refer to [the documentation](https://docs.svix.com/).



    ## Idempotency


    Svix supports [idempotency](https://en.wikipedia.org/wiki/Idempotence) for safely retrying requests without accidentally performing the same operation twice. This is useful when an API call is disrupted in transit and you do not receive a response.


    To perform an idempotent request, pass the idempotency key in the `Idempotency-Key` header to the request. The idempotency key should be a unique value generated by the client. You can create the key in however way you like, though we suggest using UUID v4, or any other string with enough entropy to avoid collisions. Your idempotency key should not begin with the string `auto_`, which is reserved for internal use by the client libraries.


    Svix''s idempotency works by saving the resulting status code and body of the first request made for any given idempotency key for any successful request. Subsequent requests with the same key return the same result for a period of up to 12 hours.


    Please note that idempotency is only supported for `POST` requests.



    ## Cross-Origin Resource Sharing


    This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). And that allows cross-domain communication from the browser. All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site.

    '
  version: 1.84.0
  x-logo:
    altText: Svix Logo
    url: https://www.svix.com/static/img/brand-padded.svg
servers:
- url: https://api.eu.svix.com/
  description: The Svix EU region
- url: https://api.us.svix.com/
  description: The Svix US region
- url: https://api.ca.svix.com/
  description: The Svix Canada region
- url: https://api.au.svix.com/
  description: The Svix Australia region
- url: https://api.in.svix.com/
  description: The Svix India region
tags:
- name: Stream Authentication
paths:
  /api/v1/auth/stream-logout:
    post:
      tags:
      - Stream Authentication
      summary: Stream Logout
      description: 'Logout a stream token.


        Trying to log out other tokens will fail.'
      operationId: v1.authentication.stream-logout
      parameters:
      - in: header
        name: idempotency-key
        description: The request's idempotency key
        schema:
          type: string
        style: simple
      - in: header
        name: idempotency-key
        description: The request's idempotency key
        schema:
          type: string
        style: simple
      responses:
        '204':
          description: no content
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
      security:
      - HTTPBearer: []
      x-codeSamples:
      - label: JavaScript
        lang: TypeScript
        source: await svix.authentication.streamLogout();
      - label: TypeScript
        lang: TypeScript
        source: await svix.authentication.streamLogout();
      - label: Python
        lang: Python
        source: svix.authentication.stream_logout()
      - label: Python (Async)
        lang: Python
        source: await svix.authentication.stream_logout()
      - label: Go
        lang: Go
        source: err := svix.Authentication.StreamLogout(ctx, nil)
      - label: Kotlin
        lang: Kotlin
        source: "svix.authentication\n    .streamLogout()"
      - label: Java
        lang: Java
        source: svix.getAuthentication().streamLogout();
      - label: Ruby
        lang: Ruby
        source: response = svix.authentication.stream_logout
      - label: Rust
        lang: Rust
        source: svix.authentication().stream_logout(None).await?;
      - label: C#
        lang: C#
        source: var response = svix.Authentication.StreamLogout();
      - label: PHP
        lang: PHP
        source: $svix->authentication->streamLogout();
      - label: CLI
        lang: Shell
        source: svix authentication stream-logout
      - label: cURL
        lang: Shell
        source: "curl -X 'POST' \\\n  'https://api.eu.svix.com/api/v1/auth/stream-logout' \\\n  -H 'Authorization: Bearer AUTH_TOKEN'"
  /api/v1/auth/stream-portal-access/{stream_id}:
    post:
      tags:
      - Stream Authentication
      summary: Get Stream Portal Access
      description: Use this function to get magic links (and authentication codes) for connecting your users to the Stream Consumer Portal.
      operationId: v1.authentication.stream-portal-access
      parameters:
      - in: path
        name: stream_id
        description: The Stream's ID or UID.
        required: true
        schema:
          description: The Stream's ID or UID.
          type: string
          maxLength: 60
          minLength: 1
          example: unique-identifier
        style: simple
      - in: header
        name: idempotency-key
        description: The request's idempotency key
        schema:
          type: string
        style: simple
      - in: header
        name: idempotency-key
        description: The request's idempotency key
        schema:
          type: string
        style: simple
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StreamPortalAccessIn'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AppPortalAccessOut'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
      security:
      - HTTPBearer: []
      x-codeSamples:
      - label: JavaScript
        lang: TypeScript
        source: "const response = await svix.authentication.streamPortalAccess(\n  \"strm_31Dc0DD72P5AddYUguyBd\",\n  {\n    expiry: 1,\n    featureFlags: [],\n    sessionId: \"user_1FB8\",\n  }\n);"
      - label: TypeScript
        lang: TypeScript
        source: "const response = await svix.authentication.streamPortalAccess(\n  \"strm_31Dc0DD72P5AddYUguyBd\",\n  {\n    expiry: 1,\n    featureFlags: [],\n    sessionId: \"user_1FB8\",\n  }\n);"
      - label: Python
        lang: Python
        source: "response = svix.authentication.stream_portal_access(\n    \"strm_31Dc0DD72P5AddYUguyBd\",\n    StreamPortalAccessIn(\n        expiry=1,\n        feature_flags=[],\n        session_id=\"user_1FB8\",\n    ),\n)"
      - label: Python (Async)
        lang: Python
        source: "response = await svix.authentication.stream_portal_access(\n    \"strm_31Dc0DD72P5AddYUguyBd\",\n    StreamPortalAccessIn(\n        expiry=1,\n        feature_flags=[],\n        session_id=\"user_1FB8\",\n    ),\n)"
      - label: Go
        lang: Go
        source: "response, err := svix.Authentication.StreamPortalAccess(\n\tctx,\n\t\"strm_31Dc0DD72P5AddYUguyBd\",\n\tStreamPortalAccessIn{\n\t\tExpiry:       new(uint64(1)),\n\t\tFeatureFlags: []string{},\n\t\tSessionId:    new(\"user_1FB8\"),\n\t},\n\tnil,\n)"
      - label: Kotlin
        lang: Kotlin
        source: "val response =\n    svix.authentication.streamPortalAccess(\n        \"strm_31Dc0DD72P5AddYUguyBd\",\n        StreamPortalAccessIn(expiry = 1u, featureFlags = setOf(), sessionId = \"user_1FB8\"),\n    )"
      - label: Java
        lang: Java
        source: "var response = svix.getAuthentication()\n        .streamPortalAccess(\n            \"strm_31Dc0DD72P5AddYUguyBd\",\n            new StreamPortalAccessIn().expiry(1L).featureFlags(Set.of()).sessionId(\"user_1FB8\"));"
      - label: Ruby
        lang: Ruby
        source: "response = svix\n  .authentication\n  .stream_portal_access(\"strm_31Dc0DD72P5AddYUguyBd\", {expiry: 1, featureFlags: [], sessionId: \"user_1FB8\"})"
      - label: Rust
        lang: Rust
        source: "let response = svix\n    .authentication()\n    .stream_portal_access(\n        \"strm_31Dc0DD72P5AddYUguyBd\".to_string(),\n        StreamPortalAccessIn {\n            expiry: Some(1),\n            feature_flags: Some(vec![]),\n            session_id: Some(\"user_1FB8\".to_string()),\n        },\n        None,\n    )\n    .await?;"
      - label: C#
        lang: C#
        source: "var response = svix.Authentication.StreamPortalAccess(\n    \"strm_31Dc0DD72P5AddYUguyBd\",\n    new StreamPortalAccessIn\n    {\n        Expiry = 1,\n        FeatureFlags = [],\n        SessionId = \"user_1FB8\",\n    }\n);"
      - label: PHP
        lang: PHP
        source: "$response = $svix->authentication->streamPortalAccess(\n    \"strm_31Dc0DD72P5AddYUguyBd\",\n    StreamPortalAccessIn::create()\n    ->withExpiry(1)\n    ->withFeatureFlags([])\n    ->withSessionId(\"user_1FB8\")\n);"
      - label: CLI
        lang: Shell
        source: "svix authentication stream-portal-access \"strm_31Dc0DD72P5AddYUguyBd\" '{\n    \"expiry\": 1,\n    \"featureFlags\": [],\n    \"sessionId\": \"user_1FB8\"\n  }'"
      - label: cURL
        lang: Shell
        source: "curl -X 'POST' \\\n  'https://api.eu.svix.com/api/v1/auth/stream-portal-access/strm_31Dc0DD72P5AddYUguyBd' \\\n  -H 'Authorization: Bearer AUTH_TOKEN' \\\n  -H 'Accept: application/json' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"expiry\": 1,\n    \"featureFlags\": [],\n    \"sessionId\": \"user_1FB8\"\n  }'"
  /api/v1/auth/stream/{stream_id}/expire-all:
    post:
      tags:
      - Stream Authentication
      summary: Stream Expire All
      description: Expire all of the tokens associated with a specific stream.
      operationId: v1.authentication.stream-expire-all
      parameters:
      - in: path
        name: stream_id
        description: The Stream's ID or UID.
        required: true
        schema:
          description: The Stream's ID or UID.
          type: string
          maxLength: 60
          minLength: 1
          example: unique-identifier
        style: simple
      - in: header
        name: idempotency-key
        description: The request's idempotency key
        schema:
          type: string
        style: simple
      - in: header
        name: idempotency-key
        description: The request's idempotency key
        schema:
          type: string
        style: simple
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StreamTokenExpireIn'
        required: true
      responses:
        '204':
          description: no content
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
      security:
      - HTTPBearer: []
      x-codeSamples:
      - label: JavaScript
        lang: TypeScript
        source: "await svix.authentication.streamExpireAll(\"strm_31Dc0DD72P5AddYUguyBd\", {\n  expiry: 60,\n  sessionIds: [],\n});"
      - label: TypeScript
        lang: TypeScript
        source: "await svix.authentication.streamExpireAll(\"strm_31Dc0DD72P5AddYUguyBd\", {\n  expiry: 60,\n  sessionIds: [],\n});"
      - label: Python
        lang: Python
        source: "svix.authentication.stream_expire_all(\n    \"strm_31Dc0DD72P5AddYUguyBd\",\n    StreamTokenExpireIn(\n        expiry=60,\n        session_ids=[],\n    ),\n)"
      - label: Python (Async)
        lang: Python
        source: "await svix.authentication.stream_expire_all(\n    \"strm_31Dc0DD72P5AddYUguyBd\",\n    StreamTokenExpireIn(\n        expiry=60,\n        session_ids=[],\n    ),\n)"
      - label: Go
        lang: Go
        source: "err := svix.Authentication.StreamExpireAll(\n\tctx,\n\t\"strm_31Dc0DD72P5AddYUguyBd\",\n\tStreamTokenExpireIn{Expiry: new(int64(60)), SessionIds: []string{}},\n\tnil,\n)"
      - label: Kotlin
        lang: Kotlin
        source: "svix.authentication.streamExpireAll(\n    \"strm_31Dc0DD72P5AddYUguyBd\",\n    StreamTokenExpireIn(expiry = 60, sessionIds = listOf()),\n)"
      - label: Java
        lang: Java
        source: "svix.getAuthentication()\n        .streamExpireAll(\n            \"strm_31Dc0DD72P5AddYUguyBd\",\n            new StreamTokenExpireIn().expiry(60L).sessionIds(List.of()));"
      - label: Ruby
        lang: Ruby
        source: 'response = svix.authentication.stream_expire_all("strm_31Dc0DD72P5AddYUguyBd", {expiry: 60, sessionIds: []})'
      - label: Rust
        lang: Rust
        source: "svix.authentication()\n    .stream_expire_all(\n        \"strm_31Dc0DD72P5AddYUguyBd\".to_string(),\n        StreamTokenExpireIn {\n            expiry: Some(60),\n            session_ids: Some(vec![]),\n        },\n        None,\n    )\n    .await?;"
      - label: C#
        lang: C#
        source: "var response = svix.Authentication.StreamExpireAll(\n    \"strm_31Dc0DD72P5AddYUguyBd\",\n    new StreamTokenExpireIn { Expiry = 60, SessionIds = [] }\n);"
      - label: PHP
        lang: PHP
        source: "$svix->authentication->streamExpireAll(\n    \"strm_31Dc0DD72P5AddYUguyBd\",\n    StreamTokenExpireIn::create()\n    ->withExpiry(60)\n    ->withSessionIds([])\n);"
      - label: CLI
        lang: Shell
        source: "svix authentication stream-expire-all \"strm_31Dc0DD72P5AddYUguyBd\" '{\n    \"expiry\": 60,\n    \"sessionIds\": []\n  }'"
      - label: cURL
        lang: Shell
        source: "curl -X 'POST' \\\n  'https://api.eu.svix.com/api/v1/auth/stream/strm_31Dc0DD72P5AddYUguyBd/expire-all' \\\n  -H 'Authorization: Bearer AUTH_TOKEN' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"expiry\": 60,\n    \"sessionIds\": []\n  }'"
  /api/v1/auth/stream/{stream_id}/sink/{sink_id}/poller/token:
    get:
      tags:
      - Stream Authentication
      summary: Get Poller Token
      description: Get the current auth token for the stream poller.
      operationId: v1.authentication.get-stream-poller-token
      parameters:
      - in: path
        name: stream_id
        description: The Stream's ID or UID.
        required: true
        schema:
          description: The Stream's ID or UID.
          type: string
          maxLength: 60
          minLength: 1
          example: unique-identifier
        style: simple
      - in: path
        name: sink_id
        description: The StreamSink's ID or UID.
        required: true
        schema:
          description: The StreamSink's ID or UID.
          type: string
          maxLength: 60
          minLength: 1
          example: unique-identifier
        style: simple
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiTokenOut'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
      security:
      - HTTPBearer: []
      x-codeSamples:
      - label: JavaScript
        lang: TypeScript
        source: "const response = await svix.authentication.getStreamPollerToken(\n  \"strm_31Dc0DD72P5AddYUguyBd\",\n  \"sink_31Dc11sPYY9aLDkwPuGMa\"\n);"
      - label: TypeScript
        lang: TypeScript
        source: "const response = await svix.authentication.getStreamPollerToken(\n  \"strm_31Dc0DD72P5AddYUguyBd\",\n  \"sink_31Dc11sPYY9aLDkwPuGMa\"\n);"
      - label: Python
        lang: Python
        source: "response = svix.authentication.get_stream_poller_token(\n    \"strm_31Dc0DD72P5AddYUguyBd\",\n    \"sink_31Dc11sPYY9aLDkwPuGMa\",\n)"
      - label: Python (Async)
        lang: Python
        source: "response = await svix.authentication.get_stream_poller_token(\n    \"strm_31Dc0DD72P5AddYUguyBd\",\n    \"sink_31Dc11sPYY9aLDkwPuGMa\",\n)"
      - label: Go
        lang: Go
        source: "response, err := svix.Authentication.GetStreamPollerToken(\n\tctx,\n\t\"strm_31Dc0DD72P5AddYUguyBd\",\n\t\"sink_31Dc11sPYY9aLDkwPuGMa\",\n)"
      - label: Kotlin
        lang: Kotlin
        source: "val response =\n    svix.authentication.getStreamPollerToken(\n        \"strm_31Dc0DD72P5AddYUguyBd\",\n        \"sink_31Dc11sPYY9aLDkwPuGMa\",\n    )"
      - label: Java
        lang: Java
        source: "var response = svix.getAuthentication()\n        .getStreamPollerToken(\"strm_31Dc0DD72P5AddYUguyBd\", \"sink_31Dc11sPYY9aLDkwPuGMa\");"
      - label: Ruby
        lang: Ruby
        source: response = svix.authentication.get_stream_poller_token("strm_31Dc0DD72P5AddYUguyBd", "sink_31Dc11sPYY9aLDkwPuGMa")
      - label: Rust
        lang: Rust
        source: "let response = svix\n    .authentication()\n    .get_stream_poller_token(\n        \"strm_31Dc0DD72P5AddYUguyBd\".to_string(),\n        \"sink_31Dc11sPYY9aLDkwPuGMa\".to_string(),\n    )\n    .await?;"
      - label: C#
        lang: C#
        source: "var response = svix.Authentication.GetStreamPollerToken(\n    \"strm_31Dc0DD72P5AddYUguyBd\",\n    \"sink_31Dc11sPYY9aLDkwPuGMa\"\n);"
      - label: PHP
        lang: PHP
        source: "$response = $svix->authentication->getStreamPollerToken(\n    \"strm_31Dc0DD72P5AddYUguyBd\",\n    \"sink_31Dc11sPYY9aLDkwPuGMa\"\n);"
      - label: CLI
        lang: Shell
        source: svix authentication get-stream-poller-token "strm_31Dc0DD72P5AddYUguyBd" "sink_31Dc11sPYY9aLDkwPuGMa"
      - label: cURL
        lang: Shell
        source: "curl -X 'GET' \\\n  'https://api.eu.svix.com/api/v1/auth/stream/strm_31Dc0DD72P5AddYUguyBd/sink/sink_31Dc11sPYY9aLDkwPuGMa/poller/token' \\\n  -H 'Authorization: Bearer AUTH_TOKEN' \\\n  -H 'Accept: application/json'"
  /api/v1/auth/stream/{stream_id}/sink/{sink_id}/poller/token/rotate:
    post:
      tags:
      - Stream Authentication
      summary: Rotate Poller Token
      description: Create a new auth token for the stream poller API.
      operationId: v1.authentication.rotate-stream-poller-token
      parameters:
      - in: path
        name: stream_id
        description: The Stream's ID or UID.
        required: true
        schema:
          description: The Stream's ID or UID.
          type: string
          maxLength: 60
          minLength: 1
          example: unique-identifier
        style: simple
      - in: path
        name: sink_id
        description: The StreamSink's ID or UID.
        required: true
        schema:
          description: The StreamSink's ID or UID.
          type: string
          maxLength: 60
          minLength: 1
          example: unique-identifier
        style: simple
      - in: header
        name: idempotency-key
        description: The request's idempotency key
        schema:
          type: string
        style: simple
      - in: header
        name: idempotency-key
        description: The request's idempotency key
        schema:
          type: string
        style: simple
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RotatePollerTokenIn'
        required: true
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiTokenOut'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
      security:
      - HTTPBearer: []
      x-codeSamples:
      - label: JavaScript
        lang: TypeScript
        source: "const response = await svix.authentication.rotateStreamPollerToken(\n  \"strm_31Dc0DD72P5AddYUguyBd\",\n  \"sink_31Dc11sPYY9aLDkwPuGMa\",\n  {\n    expiry: 1,\n    oldTokenExpiry: 1,\n  }\n);"
      - label: TypeScript
        lang: TypeScript
        source: "const response = await svix.authentication.rotateStreamPollerToken(\n  \"strm_31Dc0DD72P5AddYUguyBd\",\n  \"sink_31Dc11sPYY9aLDkwPuGMa\",\n  {\n    expiry: 1,\n    oldTokenExpiry: 1,\n  }\n);"
      - label: Python
        lang: Python
        source: "response = svix.authentication.rotate_stream_poller_token(\n    \"strm_31Dc0DD72P5AddYUguyBd\",\n    \"sink_31Dc11sPYY9aLDkwPuGMa\",\n    RotatePollerTokenIn(\n        expiry=1,\n        old_token_expiry=1,\n    ),\n)"
      - label: Python (Async)
        lang: Python
        source: "response = await svix.authentication.rotate_stream_poller_token(\n    \"strm_31Dc0DD72P5AddYUguyBd\",\n    \"sink_31Dc11sPYY9aLDkwPuGMa\",\n    RotatePollerTokenIn(\n        expiry=1,\n        old_token_expiry=1,\n    ),\n)"
      - label: Go
        lang: Go
        source: "response, err := svix.Authentication.RotateStreamPollerToken(\n\tctx,\n\t\"strm_31Dc0DD72P5AddYUguyBd\",\n\t\"sink_31Dc11sPYY9aLDkwPuGMa\",\n\tRotatePollerTokenIn{Expiry: new(int64(1)), OldTokenExpiry: new(int64(1))},\n\tnil,\n)"
      - label: Kotlin
        lang: Kotlin
        source: "val response =\n    svix.authentication.rotateStreamPollerToken(\n        \"strm_31Dc0DD72P5AddYUguyBd\",\n        \"sink_31Dc11sPYY9aLDkwPuGMa\",\n        RotatePollerTokenIn(expiry = 1, oldTokenExpiry = 1),\n    )"
      - label: Java
        lang: Java
        source: "var response = svix.getAuthentication()\n        .rotateStreamPollerToken(\n            \"strm_31Dc0DD72P5AddYUguyBd\",\n            \"sink_31Dc11sPYY9aLDkwPuGMa\",\n            new RotatePollerTokenIn().expiry(1L).oldTokenExpiry(1L));"
      - label: Ruby
        lang: Ruby
        source: "response = svix\n  .authentication\n  .rotate_stream_poller_token(\n    \"strm_31Dc0DD72P5AddYUguyBd\",\n    \"sink_31Dc11sPYY9aLDkwPuGMa\",\n    {expiry: 1, oldTokenExpiry: 1}\n  )"
      - label: Rust
        lang: Rust
        source: "let response = svix\n    .authentication()\n    .rotate_stream_poller_token(\n        \"strm_31Dc0DD72P5AddYUguyBd\".to_string(),\n        \"sink_31Dc11sPYY9aLDkwPuGMa\".to_string(),\n        RotatePollerTokenIn {\n            expiry: Some(1),\n            old_token_expiry: Some(1),\n        },\n        None,\n    )\n    .await?;"
      - label: C#
        lang: C#
        source: "var response = svix.Authentication.RotateStreamPollerToken(\n    \"strm_31Dc0DD72P5AddYUguyBd\",\n    \"sink_31Dc11sPYY9aLDkwPuGMa\",\n    new RotatePollerTokenIn { Expiry = 1, OldTokenExpiry = 1 }\n);"
      - label: PHP
        lang: PHP
        source: "$response = $svix->authentication->rotateStreamPollerToken(\n    \"strm_31Dc0DD72P5AddYUguyBd\",\n    \"sink_31Dc11sPYY9aLDkwPuGMa\",\n    RotatePollerTokenIn::create()\n    ->withExpiry(1)\n    ->withOldTokenExpiry(1)\n);"
      - label: CLI
        lang: Shell
        source: "svix authentication rotate-stream-poller-token \"strm_31Dc0DD72P5AddYUguyBd\" \"sink_31Dc11sPYY9aLDkwPuGMa\" '{\n    \"expiry\": 1,\n    \"oldTokenExpiry\": 1\n  }'"
      - label: cURL
        lang: Shell
        source: "curl -X 'POST' \\\n  'https://api.eu.svix.com/api/v1/auth/stream/strm_31Dc0DD72P5AddYUguyBd/sink/sink_31Dc11sPYY9aLDkwPuGMa/poller/token/rotate' \\\n  -H 'Authorization: Bearer AUTH_TOKEN' \\\n  -H 'Accept: application/json' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"expiry\": 1,\n    \"oldTokenExpiry\": 1\n  }'"
components:
  schemas:
    HTTPValidationError:
      type: object
      required:
      - detail
      properties:
        detail:
          type: array
          items:
            $ref: '#/components/schemas/ValidationError'
    ValidationError:
      description: Validation errors have their own schema to provide context for invalid requests eg. mismatched types and out of bounds values. There may be any number of these per 422 UNPROCESSABLE ENTITY error.
      type: object
      required:
      - loc
      - msg
      - type
      properties:
        loc:
          description: The location as a [`Vec`] of [`String`]s -- often in the form `["body", "field_name"]`, `["query", "field_name"]`, etc. They may, however, be arbitrarily deep.
          type: array
          items:
            type: string
        msg:
          description: The message accompanying the validation error item.
          type: string
        type:
          description: The type of error, often "type_error" or "value_error", but sometimes with more context like as "value_error.number.not_ge"
          type: string
    StreamTokenExpireIn:
      type: object
      properties:
        expiry:
          description: How many seconds until the old key is expired.
          type: integer
          format: int64
          maximum: 259200.0
          minimum: 0.0
          example: 60
          nullable: true
        sessionIds:
          description: 'An optional list of session ids.


            If any session ids are specified, only Stream tokens created with that session id will be expired.'
          type: array
          items:
            type: string
            maxLength: 64
            minLength: 1
            pattern: ^[a-zA-Z0-9@_-]+$
            example: user_1FB8
          maxItems: 1000
    ApiTokenOut:
      type: object
      required:
      - createdAt
      - id
      - token
      properties:
        createdAt:
          type: string
          format: date-time
        expiresAt:
          type: string
          format: date-time
          nullable: true
        id:
          type: string
        name:
          type: string
          nullable: true
        s

# --- truncated at 32 KB (48 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/svix/refs/heads/main/openapi/svix-stream-authentication-api-openapi.yml