Reconnect Integration
POST/api/temu/:integrationInstance/reconnect
Re-authorizes an existing TemuIntegrationInstance with a fresh OAuth access token.
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 acodestored 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
- 200
- 401
- 403
- 404
- 422
- 429
- 500
OK
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Not found — no record with the given identifier (or the route does not exist). Verify the ID before retrying.
Validation failed — the body is a field → messages map (Laravel shape) or the platform envelope with a stable machine-readable code. Fix the payload and resubmit.
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.
Internal Server Error