> ## 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.

# Reconnect mailbox

> Requests reconnection of a mailbox that has lost access. Branch on the response `result` field (not mailbox.status alone).

Results:
- reconnected: credentials verified; mailbox is active again. nextStep: nothing to do.
- already_connected: mailbox was already active. nextStep: nothing to do.
- disconnected: still access_lost after an SMTP/IMAP check. nextStep: PATCH .../connection-settings, then retry reconnect. If the provider account is missing, send both SMTP and IMAP so it is registered again.
- oauth_required: Google/Outlook needs user consent. nextStep: open oauthUrl, then handle redirectUrl. redirectUrl is required and must be allowlisted (contact Salesforge support).
- suspended: admin/billing suspension. nextStep: contact support.
- deleted: mailbox is deleted. nextStep: connect again as a new mailbox.
- pending: connection still being set up. nextStep: wait and poll GET mailbox.
- ineligible: reconnect does not apply for this state.

redirectUrl: required for Google/Outlook OAuth mailboxes; omit for SMTP/IMAP. Same allowlisting rules as POST /mailboxes/oauth-link.



## OpenAPI

````yaml https://api.salesforge.ai/public/v2/swagger/doc.json post /workspaces/{workspaceID}/mailboxes/{mailboxID}/reconnect
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/{mailboxID}/reconnect:
    post:
      tags:
        - mailboxes
      summary: Reconnect mailbox
      description: >-
        Requests reconnection of a mailbox that has lost access. Branch on the
        response `result` field (not mailbox.status alone).


        Results:

        - reconnected: credentials verified; mailbox is active again. nextStep:
        nothing to do.

        - already_connected: mailbox was already active. nextStep: nothing to
        do.

        - disconnected: still access_lost after an SMTP/IMAP check. nextStep:
        PATCH .../connection-settings, then retry reconnect. If the provider
        account is missing, send both SMTP and IMAP so it is registered again.

        - oauth_required: Google/Outlook needs user consent. nextStep: open
        oauthUrl, then handle redirectUrl. redirectUrl is required and must be
        allowlisted (contact Salesforge support).

        - suspended: admin/billing suspension. nextStep: contact support.

        - deleted: mailbox is deleted. nextStep: connect again as a new mailbox.

        - pending: connection still being set up. nextStep: wait and poll GET
        mailbox.

        - ineligible: reconnect does not apply for this state.


        redirectUrl: required for Google/Outlook OAuth mailboxes; omit for
        SMTP/IMAP. Same allowlisting rules as POST /mailboxes/oauth-link.
      parameters:
        - description: Workspace ID
          in: path
          name: workspaceID
          required: true
          schema:
            type: string
        - description: Mailbox ID
          in: path
          name: mailboxID
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
                - type: object
                - $ref: '#/components/schemas/api.ReconnectMailboxRequest'
                  description: >-
                    Reconnect request. redirectUrl required for Google/Outlook
                    (allowlisted); omit for SMTP/IMAP.
                  summary: request
        description: >-
          Reconnect request. redirectUrl required for Google/Outlook
          (allowlisted); omit for SMTP/IMAP.
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api.ReconnectMailboxResponse'
          description: Reconnect outcome
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.Error'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.Error'
          description: Unauthorized
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.Error'
          description: Mailbox not found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.Error'
          description: Internal Server Error
      security:
        - ApiKeyAuth: []
components:
  schemas:
    api.ReconnectMailboxRequest:
      properties:
        redirectUrl:
          description: >-
            HTTPS URL the user is redirected to after OAuth re-authorization.

            Required for Google and Outlook mailboxes; omit for SMTP/IMAP.

            Must be pre-allowlisted — contact Salesforge support to add your
            URL.
          example: https://partner.example/oauth/callback
          type: string
      type: object
    api.ReconnectMailboxResponse:
      properties:
        mailbox:
          $ref: '#/components/schemas/api.MailboxResponse'
        message:
          description: Short explanation of the outcome.
          example: Mailbox credentials were verified and the mailbox is active again.
          type: string
        nextStep:
          description: What the caller should do next.
          example: Nothing to do.
          type: string
        oauthUrl:
          description: OAuth authorization URL. Present only when result is oauth_required.
          example: https://accounts.google.com/o/oauth2/auth?...
          type: string
        result:
          $ref: '#/components/schemas/api.ReconnectMailboxResult'
      type: object
    errors.Error:
      allOf:
        - $ref: '#/components/schemas/data'
      properties:
        data: {}
        message:
          type: string
      type: object
    api.MailboxResponse:
      properties:
        address:
          type: string
        dailyEmailLimit:
          type: integer
        disconnectReason:
          type: string
        firstName:
          type: string
        id:
          type: string
        lastName:
          type: string
        mailboxProvider:
          $ref: '#/components/schemas/models.MailboxProvider'
        resolvedSignature:
          type: string
        signature:
          type: string
        status:
          $ref: '#/components/schemas/models.MailboxStatus'
        trackingDomain:
          type: string
        trackingDomainStatus:
          $ref: '#/components/schemas/models.TrackingDomainStatus'
      type: object
    api.ReconnectMailboxResult:
      description: >-
        Explicit reconnect outcome. Prefer this over combining fields with
        mailbox.status.
      enum:
        - reconnected
        - already_connected
        - disconnected
        - oauth_required
        - suspended
        - deleted
        - pending
        - ineligible
      example: reconnected
      type: string
      x-enum-varnames:
        - ReconnectMailboxResultReconnected
        - ReconnectMailboxResultAlreadyConnected
        - ReconnectMailboxResultDisconnected
        - ReconnectMailboxResultOAuthRequired
        - ReconnectMailboxResultSuspended
        - ReconnectMailboxResultDeleted
        - ReconnectMailboxResultPending
        - ReconnectMailboxResultIneligible
    data:
      properties:
        data:
          items:
            $ref: '#/components/schemas/api.DNCResponse'
          type: array
      type: object
    models.MailboxProvider:
      enum:
        - gmail
        - outlook
        - smtp
      type: string
      x-enum-varnames:
        - MailboxProviderGmail
        - MailboxProviderOutlook
        - MailboxProviderSmtp
    models.MailboxStatus:
      enum:
        - active
        - frozen
        - access_lost
        - deleted
        - inactive
        - pending
        - suspended
      type: string
      x-enum-varnames:
        - MailboxStatusActive
        - MailboxStatusFrozen
        - MailboxStatusAccessLost
        - MailboxStatusDeleted
        - MailboxStatusInactive
        - MailboxStatusPending
        - MailboxStatusSuspended
    models.TrackingDomainStatus:
      enum:
        - active
        - pending
      type: string
      x-enum-varnames:
        - TrackingDomainStatusActive
        - TrackingDomainStatusPending
    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

````

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