> ## Documentation Index
> Fetch the complete documentation index at: https://docs.canary.effectiveai.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Check a browser sign-in and receive its API key

> Poll with the deviceCode from createDeviceAuthorization, waiting interval seconds between calls. Returns status pending until the user decides. Once approved, returns status approved with a new API key for the approving user; the key has their permissions, expires after 90 days and appears on their API Keys page. The key is returned only once: later calls return 410. Store it securely and do not print it. Calling faster than interval returns 429.



## OpenAPI

````yaml /openapi.json post /device-authorizations/exchange
openapi: 3.0.3
info:
  title: Effective API
  version: 2.0.0
  description: The public Effective REST API. Authenticate using an Effective API key.
servers:
  - url: https://api.canary.effectiveai.app/api/v2
    description: Canary
security:
  - bearerAuth: []
paths:
  /device-authorizations/exchange:
    post:
      tags:
        - Device sign-in
      summary: Check a browser sign-in and receive its API key
      description: >-
        Poll with the deviceCode from createDeviceAuthorization, waiting
        interval seconds between calls. Returns status pending until the user
        decides. Once approved, returns status approved with a new API key for
        the approving user; the key has their permissions, expires after 90 days
        and appears on their API Keys page. The key is returned only once: later
        calls return 410. Store it securely and do not print it. Calling faster
        than interval returns 429.
      operationId: exchangeDeviceAuthorization
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/V2ExchangeDeviceAuthorizationRequest'
      responses:
        '200':
          description: Still pending, or approved with the new API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2DeviceAuthorizationExchange'
        '400':
          description: 'invalid_request: deviceCode is missing.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '403':
          description: 'device_authorization_denied: the user denied the request.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '404':
          description: 'not_found: no sign-in has this deviceCode.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '410':
          description: >-
            device_authorization_expired: the request expired or its key was
            already issued. Start a new sign-in.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '415':
          description: 'unsupported_media_type: use application/json.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '429':
          description: >-
            rate_limited: called before interval elapsed; wait Retry-After
            seconds.
          headers:
            Retry-After:
              required: true
              schema:
                type: integer
                minimum: 0
              description: Seconds to wait before retrying.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '500':
          description: 'internal_error: unexpected server error.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '503':
          description: 'temporarily_unavailable: respect Retry-After.'
          headers:
            Retry-After:
              required: true
              schema:
                type: integer
                minimum: 0
              description: Seconds to wait before retrying.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
      security: []
components:
  schemas:
    V2ExchangeDeviceAuthorizationRequest:
      type: object
      properties:
        deviceCode:
          type: string
          minLength: 1
          maxLength: 128
          description: deviceCode from createDeviceAuthorization.
      required:
        - deviceCode
      additionalProperties: false
    V2DeviceAuthorizationExchange:
      oneOf:
        - $ref: '#/components/schemas/V2DeviceAuthorizationPending'
        - $ref: '#/components/schemas/V2DeviceAuthorizationApproved'
      discriminator:
        propertyName: status
        mapping:
          pending: '#/components/schemas/V2DeviceAuthorizationPending'
          approved: '#/components/schemas/V2DeviceAuthorizationApproved'
    V2CodedError:
      allOf:
        - $ref: '#/components/schemas/V2Error'
        - type: object
          properties:
            code:
              type: string
              minLength: 1
              description: Stable error code. Clients must tolerate unknown future codes.
            details:
              type: array
              items:
                type: object
                properties:
                  location:
                    type: string
                    enum:
                      - path
                      - query
                      - header
                      - body
                  path:
                    type: array
                    items:
                      type: string
                      maxLength: 64
                    maxItems: 12
                  code:
                    type: string
                    enum:
                      - required
                      - invalid_type
                      - invalid_value
                      - unknown_field
                  message:
                    type: string
                    minLength: 1
                    maxLength: 200
                required:
                  - location
                  - path
                  - code
                  - message
              minItems: 1
              maxItems: 20
              description: Bounded safe validation issues; may omit some invalid fields.
            requestId:
              type: string
              minLength: 1
              maxLength: 128
              description: >-
                Existing server correlation for this HTTP attempt, when
                available.
            dataset:
              type: string
              enum:
                - naic
                - osha
              description: Dataset needed for dataset_not_enabled.
            accessUrl:
              type: string
              nullable: true
              format: uri
              description: >-
                Where to add the product to your account, for
                product_access_required.
          required:
            - code
    V2DeviceAuthorizationPending:
      type: object
      properties:
        status:
          type: string
          enum:
            - pending
          description: Nobody has approved or denied the request yet.
        interval:
          type: integer
          minimum: 0
          exclusiveMinimum: true
          description: Seconds to wait before the next call.
      required:
        - status
        - interval
      additionalProperties: false
    V2DeviceAuthorizationApproved:
      type: object
      properties:
        status:
          type: string
          enum:
            - approved
          description: The user approved; the key is returned once.
        apiKey:
          type: string
          description: >-
            New user API key. It is returned only in this response. Store it
            securely and never print it.
        apiKeyId:
          type: string
          description: ID of the key, as listed on the API Keys settings page.
        tenantId:
          type: string
          description: Tenant the key belongs to.
          example: acme
        expiresAt:
          type: string
          format: date-time
          description: When the key expires.
      required:
        - status
        - apiKey
        - apiKeyId
        - tenantId
        - expiresAt
      additionalProperties: false
    V2Error:
      type: object
      properties:
        error:
          type: string
          minLength: 1
          description: Human-readable explanation of the failure.
      required:
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Effective API key. Send Authorization: Bearer sk-eai-...'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.