Developer API & DRM

The AssetFactory API lets your server, launcher or game verify ownership and manage licenses. Version 2.0 is the recommended API. Version 1 remains available for existing integrations while they migrate.

Version 2 uses header-only API keys, JSON bodies for sensitive lookups, consistent ownership checks, request IDs, and a POST-only DRM validator that does not place license secrets in URLs.

Getting a key

Create and manage keys on your Developer page. A key is shown once at creation - store it securely (treat it like a password). Keys only ever expose data for your own products and their buyers.

Authentication

Send a creator API key in the Authorization header. Version 2 intentionally rejects keys in query strings.

Authorization: Bearer af_live_xxxxxxxx

Base URL

https://assetfactory.net//api/v2

Endpoints

GET /ping

curl -H "Authorization: Bearer af_live_xxx" https://assetfactory.net//api/v2/ping

GET /products

Lists products belonging to the key owner. Supports limit (maximum 100) and after_id.

curl -H "Authorization: Bearer af_live_xxx" https://assetfactory.net//api/v2/products

POST /ownership

Checks whether a buyer owns one of your products. Send asset_id and exactly one of user_id, username, or steam_id.

curl -X POST -H "Authorization: Bearer af_live_xxx" -H "Content-Type: application/json" \
  -d '{"asset_id":42,"steam_id":"76561198000000000"}' https://assetfactory.net//api/v2/ownership

POST /licenses/suspend and /licenses/activate

Write-scoped keys can suspend or restore a buyer token. Use the same JSON buyer identifiers as /ownership.

Buyer-token DRM activation and leases

Use the POST-only endpoint below from your server or SDK. It does not require a creator API key; the buyer activation token is its credential. Always use HTTPS in production. Every attempt needs a new 16-64 character request_id, which prevents simple replay. A successful activation registers the device and returns a short-lived lease_token.

curl -X POST -H "Content-Type: application/json" \
  -d '{"token":"DRM-...","request_id":"01JREQUEST00000001","device_id":"stable-server-id","device_name":"Main server","port":25565}' \
  https://assetfactory.net//api/v2/drm/validate

Use the returned lease for normal runtime checks. The permanent activation token is needed only when the lease approaches its refresh_after time.

curl -X POST -H "Content-Type: application/json" \
  -d '{"lease_token":"afl_...","request_id":"01JREQUEST00000002","device_id":"stable-server-id","port":25565}' \
  https://assetfactory.net//api/v2/drm/lease/check

Responses & errors

Responses include api_version and request_id. Errors have a stable code and a human-readable message.

{"api_version":"2.0","request_id":"...","ok":false,"error":{"code":"unauthorized","message":"..."}}
  • 401 unauthorized - missing/invalid/revoked key
  • 403 forbidden - the resource is not one of your products
  • 409 replayed_request - a DRM request ID was already used for this token
  • 403 device_limit_reached - the buyer used every device slot configured by the seller
  • 422 invalid_request - required JSON fields are missing or invalid

Notes

  • Keys are scoped to the owner - you can never read another creator's sales or buyers.
  • Revoke a key any time from the Developer page; revoked keys stop working immediately.
  • Send keys server-side only. Never embed a live key in client-side code you ship to users.
  • The legacy /api/v1 and /api/drm/TOKEN routes remain available during migration, but new integrations should not use them.