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

# Oauth Callback

> Exchange the authorization code for tokens and persist as tool_config.



## OpenAPI

````yaml /api-reference/openapi.json post /api/emailing/microsoft/callback
openapi: 3.1.0
info:
  title: apowerb API
  description: REST API of the apowerb agentic framework (open-source edition).
  version: 0.1.2
  license:
    name: MIT
    url: https://github.com/apowerb/apowerb/blob/main/LICENSE
servers:
  - url: https://api.example.com
    description: Your apowerb instance
  - url: http://localhost:8000
    description: Local stack
security: []
paths:
  /api/emailing/microsoft/callback:
    post:
      tags:
        - emailing
      summary: Oauth Callback
      description: Exchange the authorization code for tokens and persist as tool_config.
      operationId: oauth_callback_api_emailing_microsoft_callback_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CallbackRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    CallbackRequest:
      properties:
        code:
          type: string
          title: Code
        state:
          anyOf:
            - type: string
            - type: 'null'
          title: State
      type: object
      required:
        - code
      title: CallbackRequest
      description: Body sent by the frontend after the Microsoft consent redirect.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````

## Related topics

- [Github Callback](/api-reference/integrations/github-callback.md)
- [Google Callback](/api-reference/integrations/google-callback.md)
- [Microsoft Service Callback](/api-reference/integrations/microsoft-service-callback.md)
- [Github Connect](/api-reference/integrations/github-connect.md)
- [Google Connect](/api-reference/integrations/google-connect.md)
