API - Overview

API - WordPress connect

Exchange a one-time connection code for the API credentials used by the plugin.

Endpoint overview

MethodEndpointDescriptionAccess
POST/public-api/v1/wp-connect/exchangeExchanges a WordPress auto-connect handoff code for API credentials.one-time handoff code

WordPress connect exchange

The WordPress connect exchange endpoint consumes a one-time handoff code and returns API credentials to the plugin. It is not a general-purpose credential creation endpoint.

Example request (fetch)

const response = await fetch('https://alterproduct.com/public-api/v1/wp-connect/exchange', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    code: 'ONE_TIME_HANDOFF_CODE',
    storeUrl: 'https://yourstore.com/',
    siteOrigin: 'https://yourstore.com',
    codeVerifier: 'PKCE_CODE_VERIFIER_32_TO_128_CHARS'
  })
});

const credentials = await response.json();

Example response

{
  "message": "wpConnect.exchange.ok",
  "accessKey": "generated-access-key",
  "accessToken": "generated-access-token",
  "storefrontId": 12
}