Skip to main content

Initialize OAuth

POST 

/api/temu/oauth/initialize

Starts a new Temu OAuth flow.

Authorization

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

Generates a tenant-prefixed state so the OAuth callback (which lands on the central landlord domain with no tenant header) can recover tenancy from the state alone. Stores the chosen name + environment + integration_settings in a file cache for 1 hour so that POST /api/temu/oauth/complete can pick them back up after the merchant returns from Temu.

The returned authorization_url is where the frontend redirects/pops up the merchant to authorize SKU.io as a Temu app.

Request body (TemuInitializeIntegrationData):

  • name (string, required) — Display name for the new integration instance.
  • environment (string, optional) — One of sandbox or production. Honoured only on non-production servers; on prod the HasIntegrationEnvironment trait pins PRODUCTION regardless. Defaults to sandbox on non-prod, production on prod.
  • integration_settings (object, optional) — Free-form JSON persisted on the instance. Used by the inventory + sync modules.

Response data:

  • state (string) — Tenant-prefixed UUID. Round-trips through the OAuth callback and must be passed back to oauth/complete.
  • authorization_url (string) — Full Temu authorization URL with appKey, redirect_uri, and state query params.

Authentication: Bearer token (Sanctum).

Throws: Exception when Temu app credentials for the selected environment are not configured (missing temu.<env>.app_key / app_secret).

Request

Responses

OK

Response Headers
    Content-Type