Skip to main content

Reconnect Integration

POST 

/api/temu/:integrationInstance/reconnect

Re-authorizes an existing TemuIntegrationInstance with a fresh OAuth access token.

Authorization

Any valid API token can call this endpoint — no specific scope required. Manage tokens.

Used when the original token has expired or been revoked. The frontend kicks off a normal OAuth flow (calls /oauth/initialize to get a state + authorization URL, sends the merchant to Temu, and the callback stores the authorization code under the same state). It then calls this endpoint to exchange that code for a new access token bound to the existing instance row — the row's environment, name, integration_settings, etc. are preserved.

In the typical browser-driven path the OAuth callback (/api/temu/oauth/callback) actually performs the reconnection itself when it detects existing instances and redirects with isReconnect=true. This endpoint exists for cases where the frontend wants to drive the reconnect explicitly.

Path parameters:

  • integrationInstance (int, required) — The ID of the TemuIntegrationInstance to reconnect.

Request body (raw JSON):

  • state (string, required) — The OAuth state from the just-completed reconnect authorization flow. Must already have a code stored in cache by the OAuth callback.

Response: 200 OK with the refreshed TemuIntegrationInstance resource and a message.

Authentication: Bearer token (Sanctum).

Throws: Exception when state is missing, when the OAuth session has expired, has already been completed, or when Temu hasn't yet posted the authorization code for this state.

Request

Responses

OK

Response Headers
    Content-Type