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

# Mail admin-consent callback

> Public. Microsoft redirects the admin here after approving or declining. Account binding comes from the single-use `state`, not a session. Answers `ok: false` with an error and detail on any failure.



## OpenAPI

````yaml /api-reference/endpoint/m365/openapi.json get /m365/mail/consent-callback
openapi: 3.0.3
info:
  title: quiva.ai Microsoft 365 API
  description: >-
    Outlook mail connection, mail filing into space folders, and mail
    automations. All routes act on the caller's own mailbox unless marked admin.
    The `/m365/rules` routes were withdrawn. Files and SharePoint sync routes
    are not part of this spec.
  version: 1.0.0
  contact:
    name: quiva.ai Support
    url: https://app.quiva.ai
servers:
  - url: https://api.quiva.ai
    description: Production API server
security:
  - bearerAuth: []
  - apiKeyAuth: []
tags:
  - name: Mail
    description: The caller's Outlook mailbox connection
  - name: Mail filing
    description: Filing mail from a mailbox into space folders
  - name: Mail automations
    description: Actions that run on each filed message
  - name: Files connection
    description: Connecting a Microsoft 365 tenant for SharePoint files
  - name: SharePoint browse
    description: Browsing sites, libraries and folders with a setup session
  - name: SharePoint sync sources
    description: Syncing a SharePoint library folder into a space
paths:
  /m365/mail/consent-callback:
    get:
      tags:
        - Mail
      summary: Mail admin-consent callback
      description: >-
        Public. Microsoft redirects the admin here after approving or declining.
        Account binding comes from the single-use `state`, not a session.
        Answers `ok: false` with an error and detail on any failure.
      operationId: mailConsentCallback
      parameters:
        - name: state
          in: query
          required: false
          description: Single-use state from the consent URL
          schema:
            type: string
        - name: tenant
          in: query
          required: false
          description: Microsoft tenant id
          schema:
            type: string
        - name: admin_consent
          in: query
          required: false
          description: '`True` when approval was granted'
          schema:
            type: string
        - name: error
          in: query
          required: false
          description: Error code when approval was declined
          schema:
            type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                  tenant_id:
                    type: string
                  message:
                    type: string
                  error:
                    type: string
                  detail:
                    type: string
                  return_to:
                    type: string
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security: []
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````

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