treg.to Auth API

The Auth API from treg.to — 20 operation(s) for auth.

GitHub OpenAPI

Operations 22

GET /auth/github Auth Github #
GET /auth/github/callback Auth Github Callback #
GET /auth/social/check Auth Social Check Page #
POST /auth/social/check Auth Social Check #
GET /auth/google Auth Google #
GET /auth/google/callback Auth Google Callback #
POST /auth/cli/start Auth Cli Start #
GET /auth/cli/poll Auth Cli Poll #
GET /auth/cli/orgs Auth Cli Orgs #
POST /auth/cli/approve Auth Cli Approve #
GET /auth/me Auth Me #
POST /auth/logout Auth Logout #
POST /auth/email/start Auth Email Start #
POST /auth/email/verify Auth Email Verify #
GET /auth/invite-signin Auth Invite Signin #
POST /auth/invite-signin Auth Invite Signin Confirm #
GET /auth/cli-token Auth Cli Token #
POST /auth/revoke-tokens Auth Revoke Tokens #
GET /auth/sso/idp/start Sso Idp Start #
GET /auth/sso/{org_slug}/start Sso Start #
POST /auth/sso/discover Sso Discover #
GET /auth/sso/callback Sso Callback #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/treg-to:treg-to-auth-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

treg-to-auth-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: treg Auth API
  version: 0.0.1
tags:
- name: Auth
paths:
  /auth/github:
    get:
      summary: Auth Github
      operationId: auth_github_auth_github_get
      parameters:
      - name: cli
        in: query
        required: false
        schema:
          type: string
          default: ''
          title: Cli
      - name: return_to
        in: query
        required: false
        schema:
          type: string
          default: ''
          title: Return To
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      tags:
      - Auth
  /auth/github/callback:
    get:
      summary: Auth Github Callback
      operationId: auth_github_callback_auth_github_callback_get
      parameters:
      - name: code
        in: query
        required: false
        schema:
          type: string
          default: ''
          title: Code
      - name: state
        in: query
        required: false
        schema:
          type: string
          default: ''
          title: State
      - name: treg_oauth_state
        in: cookie
        required: false
        schema:
          type: string
          default: ''
          title: Treg Oauth State
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      tags:
      - Auth
  /auth/social/check:
    get:
      summary: Auth Social Check Page
      description: 'A provider proved an address no verified user holds yet: run the browser check, then post

        its token to finish signing in. Without a waiting login (Back after signing in) go on to /app.

        A check with no token is offered once more, then the sign-in finishes without credit; without

        script the button finishes it at once.'
      operationId: auth_social_check_page_auth_social_check_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
      tags:
      - Auth
    post:
      summary: Auth Social Check
      operationId: auth_social_check_auth_social_check_post
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/Body_auth_social_check_auth_social_check_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      tags:
      - Auth
  /auth/google:
    get:
      summary: Auth Google
      description: Human login via Google OAuth — a parallel door to GitHub, same session/CLI-handshake plumbing.
      operationId: auth_google_auth_google_get
      parameters:
      - name: cli
        in: query
        required: false
        schema:
          type: string
          default: ''
          title: Cli
      - name: return_to
        in: query
        required: false
        schema:
          type: string
          default: ''
          title: Return To
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      tags:
      - Auth
  /auth/google/callback:
    get:
      summary: Auth Google Callback
      operationId: auth_google_callback_auth_google_callback_get
      parameters:
      - name: code
        in: query
        required: false
        schema:
          type: string
          default: ''
          title: Code
      - name: state
        in: query
        required: false
        schema:
          type: string
          default: ''
          title: State
      - name: treg_oauth_state
        in: cookie
        required: false
        schema:
          type: string
          default: ''
          title: Treg Oauth State
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      tags:
      - Auth
  /auth/cli/start:
    post:
      summary: Auth Cli Start
      description: '`treg login` calls this FIRST. The SERVER mints both the login_id and a short pairing code and

        remembers them (pending approval). The code is shown only in that terminal; the browser must echo it

        back at approve time, where it''s validated server-side, before any token is issued. So a login the

        user didn''t start (a phished /login?cli= link) can''t be completed, and the poll endpoint carries

        no code to brute-force. Unauthenticated — on its own it grants nothing.'
      operationId: auth_cli_start_auth_cli_start_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Auth Cli Start Auth Cli Start Post
      tags:
      - Auth
  /auth/cli/poll:
    get:
      summary: Auth Cli Poll
      description: 'The CLI polls this after opening the browser; returns the identity token once, then forgets it.

        A token only lands here after auth_cli_approve validated the terminal pairing code, so a login the

        user didn''t approve never yields one — there is nothing here to brute-force (no code parameter).'
      operationId: auth_cli_poll_auth_cli_poll_get
      parameters:
      - name: login_id
        in: query
        required: false
        schema:
          type: string
          default: ''
          title: Login Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Auth Cli Poll Auth Cli Poll Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      tags:
      - Auth
  /auth/cli/orgs:
    get:
      summary: Auth Cli Orgs
      description: 'The /login page fetches this (session-cookie authed) to render the team picker before completing

        a `treg login` handshake. Returns the signed-in user''s teams; empty list if no session.'
      operationId: auth_cli_orgs_auth_cli_orgs_get
      parameters:
      - name: treg_session
        in: cookie
        required: false
        schema:
          type: string
          default: ''
          title: Treg Session
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Auth Cli Orgs Auth Cli Orgs Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      tags:
      - Auth
  /auth/cli/approve:
    post:
      summary: Auth Cli Approve
      description: 'Complete a `treg login` handshake from an EXISTING browser session (the "Continue as" button

        on /login, and the email door after /auth/email/verify sets the cookie). Deliberately a POST with

        a same-origin check — auto-completing on a GET would let a phisher mail out /login?cli=

        and poll the victim''s identity token straight out of /auth/cli/poll.


        `org` (optional) is the team slug the user picked in the /login org picker; it''s validated to be

        one of the user''s memberships and passed back to the CLI so it lands on the RIGHT team instead of

        guessing (`_pick_active_org`).'
      operationId: auth_cli_approve_auth_cli_approve_post
      parameters:
      - name: treg_session
        in: cookie
        required: false
        schema:
          type: string
          default: ''
          title: Treg Session
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CliApproveIn'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Auth Cli Approve Auth Cli Approve Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      tags:
      - Auth
  /auth/me:
    get:
      summary: Auth Me
      description: 'Who is the caller? Drives the dashboard''s identity display in BOTH session mode (cookie) and

        token mode (X-Treg-Token) — the token door otherwise had no way to learn its own email, which

        broke `isPersonal` and join-by-code.'
      operationId: auth_me_auth_me_get
      parameters:
      - name: x-treg-token
        in: header
        required: false
        schema:
          type: string
          default: ''
          title: X-Treg-Token
      - name: treg_session
        in: cookie
        required: false
        schema:
          type: string
          default: ''
          title: Treg Session
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Auth Me Auth Me Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      tags:
      - Auth
  /auth/logout:
    post:
      summary: Auth Logout
      operationId: auth_logout_auth_logout_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
      tags:
      - Auth
  /auth/email/start:
    post:
      summary: Auth Email Start
      description: 'Prove ownership of an email: mint a 6-digit code. With no mail sender yet, dev mode returns

        + logs it (so dummy emails are testable); prod will email it instead. Throttled per-email AND per-IP

        (sliding window) so this open endpoint can''t be used to email-bomb an inbox or reset the OTP

        brute-force counter at will. All this state is in the DB (survives restart, correct multi-instance).'
      operationId: auth_email_start_auth_email_start_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmailStartIn'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Auth Email Start Auth Email Start Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      tags:
      - Auth
  /auth/email/verify:
    post:
      summary: Auth Email Verify
      description: 'Check the code → find-or-create the user → mint an identity token AND set a browser session

        cookie. The CLI reads the token from the body; the dashboard just reloads into session mode

        (same path as GitHub login) — one endpoint serves both clients.'
      operationId: auth_email_verify_auth_email_verify_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmailVerifyIn'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      tags:
      - Auth
  /auth/invite-signin:
    get:
      summary: Auth Invite Signin
      description: 'Landing for an invite email link. Neither secret signs anyone in: the emailed `t` and the

        admin-visible `code` only prefill the invitee''s address on the SPA login, where they prove it

        through a real door (OTP / GitHub / Google) and the invite appears via /invites/mine. An

        invalid/expired secret lands on the site with the expired banner.'
      operationId: auth_invite_signin_auth_invite_signin_get
      parameters:
      - name: code
        in: query
        required: false
        schema:
          type: string
          default: ''
          title: Code
      - name: t
        in: query
        required: false
        schema:
          type: string
          default: ''
          title: T
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      tags:
      - Auth
    post:
      summary: Auth Invite Signin Confirm
      description: 'The confirm button of invite pages rendered before links stopped signing in. Treated like

        the GET: prefill, never a session. Body is parsed by hand (urlencoded form) to avoid the

        python-multipart dependency FastAPI''s Form() would pull in.'
      operationId: auth_invite_signin_confirm_auth_invite_signin_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
      tags:
      - Auth
  /auth/cli-token:
    get:
      summary: Auth Cli Token
      description: 'Mint a fresh CLI/bearer token for the authenticated caller (session cookie OR token). Identity

        tokens are signed (`sess.make_identity`); minting the current generation invalidates nothing — it lets

        the dashboard embed a working token in copy-paste snippets + a ''copy token'' button, so a human

        doesn''t have to hunt for it in `~/.treg/config.json`.


        When the caller names a team (the dashboard sends `X-Treg-Org` for the active org, and only after

        confirming membership), the org slug is BAKED into the token. That is what makes the dashboard''s

        "your API key" work as a bare bearer where no `X-Treg-Org` header can travel — pasted into an MCP

        server''s Authorization it resolves to that team, no header, no per-org agent token to manage. A

        caller who sends no team receives a seven-day bootstrap credential for onboarding only. It

        cannot access team resources or use itself to mint a Default key. The response also identifies

        the selected Default control and its active/disabled state so Getting Started never reveals a

        disabled token.'
      operationId: auth_cli_token_auth_cli_token_get
      parameters:
      - name: x-treg-org
        in: header
        required: false
        schema:
          type: string
          default: ''
          title: X-Treg-Org
      - name: x-treg-token
        in: header
        required: false
        schema:
          type: string
          default: ''
          title: X-Treg-Token
      - name: treg_session
        in: cookie
        required: false
        schema:
          type: string
          default: ''
          title: Treg Session
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Auth Cli Token Auth Cli Token Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      tags:
      - Auth
  /auth/revoke-tokens:
    post:
      summary: Auth Revoke Tokens
      description: 'Kill switch for a leaked token: invalidate every signed identity token (from `treg login`) AND

        every browser session this user holds, in one step. Bumping user.token_version makes all previously

        minted tokens (which carry the old tv) mismatch and be rejected. Unlike suspending the account this

        keeps the user active; unlike rotating TREG_SESSION_SECRET it affects ONLY this user. We then re-issue

        a fresh session cookie + token for the caller, so the device that pressed the button stays signed in

        while every other device is signed out. (Org membership tokens from accept-invite are a separate token

        type and are unaffected — those are revoked by removing the membership.)'
      operationId: auth_revoke_tokens_auth_revoke_tokens_post
      parameters:
      - name: x-treg-token
        in: header
        required: false
        schema:
          type: string
          default: ''
          title: X-Treg-Token
      - name: x-treg-org
        in: header
        required: false
        schema:
          type: string
          default: ''
          title: X-Treg-Org
      - name: treg_session
        in: cookie
        required: false
        schema:
          type: string
          default: ''
          title: Treg Session
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      tags:
      - Auth
  /auth/sso/idp/start:
    get:
      summary: Sso Idp Start
      description: An Okta app tile supplies a connection hint, then starts our normal checked flow.
      operationId: sso_idp_start_auth_sso_idp_start_get
      parameters:
      - name: connection_id
        in: query
        required: false
        schema:
          type: string
          default: ''
          title: Connection Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      tags:
      - Auth
  /auth/sso/{org_slug}/start:
    get:
      summary: Sso Start
      operationId: sso_start_auth_sso__org_slug__start_get
      parameters:
      - name: org_slug
        in: path
        required: true
        schema:
          type: string
          title: Org Slug
      - name: return_to
        in: query
        required: false
        schema:
          type: string
          default: ''
          title: Return To
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      tags:
      - Auth
  /auth/sso/discover:
    post:
      summary: Sso Discover
      description: Email routes a visitor to a connection; only the WorkOS callback can grant access.
      operationId: sso_discover_auth_sso_discover_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DiscoverIn'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Sso Discover Auth Sso Discover Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      tags:
      - Auth
  /auth/sso/callback:
    get:
      summary: Sso Callback
      operationId: sso_callback_auth_sso_callback_get
      parameters:
      - name: code
        in: query
        required: false
        schema:
          type: string
          default: ''
          title: Code
      - name: state
        in: query
        required: false
        schema:
          type: string
          default: ''
          title: State
      - name: error
        in: query
        required: false
        schema:
          type: string
          default: ''
          title: Error
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      tags:
      - Auth
components:
  schemas:
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    Body_auth_social_check_auth_social_check_post:
      properties:
        captcha_token:
          type: string
          title: Captcha Token
          default: ''
      type: object
      title: Body_auth_social_check_auth_social_check_post
    CliApproveIn:
      properties:
        login_id:
          type: string
          title: Login Id
        code:
          anyOf:
          - type: string
          - type: 'null'
          title: Code
        org:
          anyOf:
          - type: string
          - type: 'null'
          title: Org
      type: object
      required:
      - login_id
      title: CliApproveIn
    DiscoverIn:
      properties:
        email:
          type: string
          title: Email
      type: object
      required:
      - email
      title: DiscoverIn
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
      - loc
      - msg
      - type
      title: ValidationError
    EmailVerifyIn:
      properties:
        email:
          type: string
          title: Email
        code:
          type: string
          title: Code
        cli_pairing:
          type: boolean
          title: Cli Pairing
          default: false
      type: object
      required:
      - email
      - code
      title: EmailVerifyIn
    EmailStartIn:
      properties:
        email:
          type: string
          title: Email
        captcha_token:
          type: string
          title: Captcha Token
          default: ''
      type: object
      required:
      - email
      title: EmailStartIn