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

# Create mailbox OAuth link

> Returns a Google or Outlook OAuth URL for connecting a mailbox. After the user authorizes, they are redirected to redirectUrl. The mailbox is auto-provisioned in Warmforge under the matching workspace.



## OpenAPI

````yaml https://api.salesforge.ai/public/v2/swagger/doc.json post /workspaces/{workspaceID}/mailboxes/oauth-link
openapi: 3.1.0
info:
  description: Get mailboxes associated with the workspace.
  termsOfService: https://www.salesforge.ai/terms
  title: Salesforge API
  version: '2.0'
servers:
  - url: https://api.salesforge.ai/public/v2
security:
  - ApiKeyAuth: []
externalDocs:
  description: ''
  url: ''
paths:
  /workspaces/{workspaceID}/mailboxes/oauth-link:
    post:
      tags:
        - mailboxes
      summary: Create mailbox OAuth link
      description: >-
        Returns a Google or Outlook OAuth URL for connecting a mailbox. After
        the user authorizes, they are redirected to redirectUrl. The mailbox is
        auto-provisioned in Warmforge under the matching workspace.
      parameters:
        - description: Workspace ID
          in: path
          name: workspaceID
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/api.CreateMailboxOAuthLinkRequest'
              description: OAuth link request
              summary: request
        description: OAuth link request
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api.MailboxOAuthLinkResponse'
          description: OAuth authorization URL
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.Error'
          description: Bad Request
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.Error'
          description: Internal Server Error
      security:
        - ApiKeyAuth: []
components:
  schemas:
    api.CreateMailboxOAuthLinkRequest:
      properties:
        email:
          description: >-
            Address to pre-select on the provider's consent screen. Optional;
            the user can still choose a

            different account, so treat the address returned on the redirect as
            authoritative.
          example: user@example.com
          type: string
        provider:
          description: >-
            Mail provider to connect: "google" or "outlook". Mailboxes on any
            other provider connect with

            their own credentials through POST
            /workspaces/{workspaceID}/mailboxes instead.
          enum:
            - google
            - outlook
          example: google
          type: string
        redirectUrl:
          description: >-
            Absolute https URL the user returns to once they have authorized the
            mailbox. It must be

            registered with Salesforge beforehand — ask support to add it — and
            may carry a path and query

            but no fragment or embedded credentials.


            Salesforge appends the result to it: mailboxId and address on
            success, or

            connection_status=failed and an error code on failure. Query
            parameters already present are

            preserved, so state can be round-tripped through this URL.
          example: https://partner.example/oauth/callback
          type: string
      required:
        - provider
        - redirectUrl
      type: object
    api.MailboxOAuthLinkResponse:
      properties:
        url:
          example: https://accounts.google.com/o/oauth2/auth?...
          type: string
      type: object
    errors.Error:
      allOf:
        - $ref: '#/components/schemas/data'
      properties:
        data: {}
        message:
          type: string
      type: object
    data:
      properties:
        data:
          items:
            $ref: '#/components/schemas/api.DNCResponse'
          type: array
      type: object
    api.DNCResponse:
      properties:
        createdAt:
          type: string
        type:
          $ref: '#/components/schemas/models.DncType'
        value:
          type: string
      type: object
    models.DncType:
      enum:
        - email
        - domain
        - linkedin
      type: string
      x-enum-varnames:
        - DncTypeEmail
        - DncTypeDomain
        - DncTypeLinkedin
  securitySchemes:
    ApiKeyAuth:
      in: header
      name: Authorization
      type: apiKey

````