My Account Endpoints

Customer-facing endpoints for managing licenses, subscriptions, API keys, and Composer configuration. All endpoints require a logged-in user.

Source: includes/api/class-slswc-myaccount-api.php


Licenses

GET /my-licenses

List the current user's licenses.

Authentication: Logged-in user

Parameters:

NameTypeRequiredDescription
pageintNoPage number (default: 1)
per_pageintNoItems per page (default: 10)
searchstringNoSearch by license key or product name
statusstringNoFilter by status (active, inactive, expired, expiring)

Example Request:

curl https://your-site.com/wp-json/slswc/v1/my-licenses?status=active \
  -H "X-WP-Nonce: YOUR_NONCE" \
  --cookie "wordpress_logged_in_xxx=..."

Success Response (200):

{
    "total": 5,
    "total_pages": 1,
    "page": 1,
    "per_page": 10,
    "items": [
        {
            "id": 42,
            "license_key": "ABCD-1234-EFGH-5678",
            "product_id": 123,
            "software_title": "My Plugin",
            "license_status": "active",
            "activations": 2,
            "max_activations": 5,
            "domains": {},
            "expiration_date": "2027-01-15 00:00:00",
            "renewal_period": "annual"
        }
    ]
}

GET /my-licenses/{id}

Get details for a single license owned by the current user.

Authentication: Logged-in user

Example Request:

curl https://your-site.com/wp-json/slswc/v1/my-licenses/42 \
  -H "X-WP-Nonce: YOUR_NONCE" \
  --cookie "wordpress_logged_in_xxx=..."

POST /my-licenses/{id}/remove-domain

Remove a domain from a license.

Authentication: Logged-in user (must own the license)

Parameters:

NameTypeRequiredDescription
domainstringYesDomain to remove

Example Request:

curl -X POST https://your-site.com/wp-json/slswc/v1/my-licenses/42/remove-domain \
  -H "X-WP-Nonce: YOUR_NONCE" \
  --cookie "wordpress_logged_in_xxx=..." \
  -d domain=https://old-site.com

POST /my-licenses/{id}/renew

Initiate a license renewal. Creates a renewal order through WooCommerce.

Authentication: Logged-in user (must own the license)

Example Request:

curl -X POST https://your-site.com/wp-json/slswc/v1/my-licenses/42/renew \
  -H "X-WP-Nonce: YOUR_NONCE" \
  --cookie "wordpress_logged_in_xxx=..."

POST /my-licenses/import-envato

Import an Envato purchase code as a license.

Authentication: Logged-in user

Parameters:

NameTypeRequiredDescription
purchase_codestringYesEnvato purchase code

Example Request:

curl -X POST https://your-site.com/wp-json/slswc/v1/my-licenses/import-envato \
  -H "X-WP-Nonce: YOUR_NONCE" \
  --cookie "wordpress_logged_in_xxx=..." \
  -d purchase_code=abc12345-def6-7890-ghij-klmnopqrstuv

Error Responses:

CodeErrorMeaning
400missing_purchase_codePurchase code is required
503envato_not_configuredEnvato integration not configured by admin

API Keys

GET /my-api-key

Get the current user's WooCommerce API key.

Authentication: Logged-in user

Example Request:

curl https://your-site.com/wp-json/slswc/v1/my-api-key \
  -H "X-WP-Nonce: YOUR_NONCE" \
  --cookie "wordpress_logged_in_xxx=..."

POST /my-api-key/create

Generate a new API key for the current user.

Authentication: Logged-in user

POST /my-api-key/revoke

Revoke the current user's API key.

Authentication: Logged-in user


Subscriptions

GET /my-subscriptions

List the current user's subscriptions.

Authentication: Logged-in user

Parameters:

NameTypeRequiredDescription
pageintNoPage number (default: 1)
per_pageintNoItems per page (default: 10)
statusstringNoFilter by status

Example Request:

curl https://your-site.com/wp-json/slswc/v1/my-subscriptions \
  -H "X-WP-Nonce: YOUR_NONCE" \
  --cookie "wordpress_logged_in_xxx=..."

POST /my-subscriptions/{id}/suspend

Suspend a subscription.

Authentication: Logged-in user (must own the subscription)

Example Request:

curl -X POST https://your-site.com/wp-json/slswc/v1/my-subscriptions/5/suspend \
  -H "X-WP-Nonce: YOUR_NONCE" \
  --cookie "wordpress_logged_in_xxx=..."

POST /my-subscriptions/{id}/cancel

Cancel a subscription.

Authentication: Logged-in user (must own the subscription)


POST /my-subscriptions/{id}/resume

Resume a suspended subscription.

Authentication: Logged-in user (must own the subscription)


POST /my-subscriptions/{id}/renew

Renew a subscription.

Authentication: Logged-in user (must own the subscription)


GET /my-subscriptions/counts

Get subscription counts for the current user, grouped by status.

Authentication: Logged-in user

Example Request:

curl https://your-site.com/wp-json/slswc/v1/my-subscriptions/counts \
  -H "X-WP-Nonce: YOUR_NONCE" \
  --cookie "wordpress_logged_in_xxx=..."

Composer Configuration

GET /my-composer-config

Get the Composer repository configuration for the current customer. Returns repository URL, auth.json snippet, and available packages based on the customer's active licenses.

Authentication: Logged-in user

Example Request:

curl https://your-site.com/wp-json/slswc/v1/my-composer-config \
  -H "X-WP-Nonce: YOUR_NONCE" \
  --cookie "wordpress_logged_in_xxx=..."

Success Response (200) โ€” Composer enabled:

{
    "enabled": true,
    "repository_url": "https://your-site.com/slswc-composer/",
    "host": "your-site.com",
    "auth_json_snippet": {
        "http-basic": {
            "your-site.com": {
                "username": "{LICENSE_KEY}",
                "password": "{LICENSE_KEY}"
            }
        }
    },
    "composer_json_snippet": {
        "type": "composer",
        "url": "https://your-site.com/slswc-composer"
    },
    "packages": [
        {
            "name": "your-vendor/my-plugin",
            "version": "1.2.0"
        }
    ],
    "license_keys": [
        "ABCD-1234-EFGH-5678"
    ]
}

Composer Disabled Response (200):

{
    "enabled": false,
    "message": "Composer repository is not enabled."
}

Was this article helpful?