Build with Portmii Connect.
Check licenses from your own server. Read the customer, Discord and Telegram accounts linked to a license key, and store your own metadata on it.
Every request identifies the license with the key your customer gives you. Responses are JSON. Example values on this page are placeholders, not real customers.
https://api.portmii.com/connect/api/v1Append the endpoint path, for example /license.
Two headers on every request.
Authorization carries your API key as is, without a Bearer prefix. x-license-key carries the license key of the customer you are asking about.
Reading a license accepts your public or secret key. Changing metadata and unlinking Discord require the secret key.
Secret key
Authorization: sk_…Full access. Keep it in server configuration and never ship it to a browser or app.
License key
x-license-key: <license-key>The key your customer received after purchase. It selects the license for this request.
Retrieve license information
#/licensePublic or secret keyRead a customer’s license: its status, your metadata and, on request, the linked customer, Discord and Telegram accounts.
Authorizationheader · requiredYour public or secret key.
x-license-keyheader · requiredThe customer’s license key.
extendquery · array · optionalAdds linked records to the response:
CUSTOMERDISCORDTELEGRAMPossible errors: 400 Invalid request, 404 Not found, 500 Server error.
set -euo pipefail
: "${PORTMII_PUBLIC_KEY:?Set PORTMII_PUBLIC_KEY}" "${PORTMII_LICENSE_KEY:?Set PORTMII_LICENSE_KEY}"
printf 'Authorization: %s\nx-license-key: %s\n' "$PORTMII_PUBLIC_KEY" "$PORTMII_LICENSE_KEY" |
curl -q --fail-with-body --silent --show-error --header @- \
--request GET \
"https://api.portmii.com/connect/api/v1/license?extend=CUSTOMER"const response = await fetch('https://api.portmii.com/connect/api/v1/license?extend=CUSTOMER', {
method: 'GET',
headers: {
Authorization: process.env.PORTMII_PUBLIC_KEY,
'x-license-key': process.env.PORTMII_LICENSE_KEY,
},
});
console.log(response.status, await response.json());{
"metadata": {
"plan": "pro"
},
"status": "<status>",
"createdAt": "2026-10-01T12:00:00.000Z",
"customer": {
"email": "user@example.com",
"name": "Sample Customer"
},
"discordClient": {
"username": "sample_user",
"discordUserId": "000000000000000000",
"avatar": "<avatar>"
},
"telegramClient": {
"username": "sample_user",
"telegramUserId": "000000000",
"avatar": "<avatar>"
}
}Set custom metadata
#/license/metadataSecret keyStore your own JSON object on a license, such as a plan name or an internal account ID.
Authorizationheader · requiredYour secret key, sk_…
x-license-keyheader · requiredThe customer’s license key.
metadatabody · objectThe JSON object to store on the license. It is returned as metadata when you read the license.
Possible errors: 400 Invalid request, 401 Authentication failed, 404 Not found, 500 Server error.
set -euo pipefail
: "${PORTMII_SECRET_KEY:?Set PORTMII_SECRET_KEY}" "${PORTMII_LICENSE_KEY:?Set PORTMII_LICENSE_KEY}"
printf 'Authorization: %s\nx-license-key: %s\n' "$PORTMII_SECRET_KEY" "$PORTMII_LICENSE_KEY" |
curl -q --fail-with-body --silent --show-error --header @- \
--header 'Content-Type: application/json' \
--data '{"metadata":{"plan":"pro"}}' \
--request PUT \
"https://api.portmii.com/connect/api/v1/license/metadata"const response = await fetch('https://api.portmii.com/connect/api/v1/license/metadata', {
method: 'PUT',
headers: {
Authorization: process.env.PORTMII_SECRET_KEY,
'x-license-key': process.env.PORTMII_LICENSE_KEY,
'Content-Type': 'application/json',
},
body: JSON.stringify({"metadata":{"plan":"pro"}}),
});
console.log(response.status, await response.json());{
"message": "OK",
"data": "<result>",
"timestamp": "2026-10-25T09:30:00.000Z"
}Unlink Discord
#/discord/unlinkSecret keyRemove the Discord account linked to a license.
Authorizationheader · requiredYour secret key, sk_…
x-license-keyheader · requiredThe customer’s license key.
This GET request changes data: it removes the Discord link. Call it only when you mean to unlink, and never prefetch it.
Possible errors: 401 Authentication failed, 404 Not found, 500 Server error.
set -euo pipefail
: "${PORTMII_SECRET_KEY:?Set PORTMII_SECRET_KEY}" "${PORTMII_LICENSE_KEY:?Set PORTMII_LICENSE_KEY}"
printf 'Authorization: %s\nx-license-key: %s\n' "$PORTMII_SECRET_KEY" "$PORTMII_LICENSE_KEY" |
curl -q --fail-with-body --silent --show-error --header @- \
--request GET \
"https://api.portmii.com/connect/api/v1/discord/unlink"const response = await fetch('https://api.portmii.com/connect/api/v1/discord/unlink', {
method: 'GET',
headers: {
Authorization: process.env.PORTMII_SECRET_KEY,
'x-license-key': process.env.PORTMII_LICENSE_KEY,
},
});
console.log(response.status, await response.json());{
"message": "OK",
"data": "<result>",
"timestamp": "2026-10-25T09:30:00.000Z"
}One error shape.
Failed requests return statusCode, errorCode, title and message. Use errorCode in your application logic.
{
"statusCode": 404,
"errorCode": "NOT_FOUND",
"title": "Not found",
"message": "The requested Resource was not found"
}400Invalid request
The Request you sent was not formatted correctly.
VALIDATION_ERROR401Authentication failed
Check your API Key and ensure it has the correct rights.
UNAUTHORIZED404Not found
The requested Resource was not found.
NOT_FOUND500Server error
Something went wrong in Portmii, try again later or contact support.
INTERNAL_SERVER_ERRORSelling access with Connect?
Set up products, Stripe checkout and Discord or Telegram access in Portmii Connect.