Customers
Delete Customer by External ID
Delete a customer by external ID.
Immediately cancels any active subscriptions and revokes any active benefits.
Set anonymize=true to also anonymize PII for GDPR compliance.
Scopes: customers:write
DELETE
/
v1
/
customers
/
external
/
{external_id}
Go (SDK)
package main
import(
"context"
"os"
polargo "github.com/polarsource/polar-go"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New(
polargo.WithSecurity(os.Getenv("POLAR_ACCESS_TOKEN")),
)
res, err := s.Customers.DeleteExternal(ctx, "<id>", polargo.Pointer(false))
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
polar.customers.delete_external(external_id="<id>", anonymize=False)
# Use the SDK ...import { Polar } from "@polar-sh/sdk";
const polar = new Polar({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
await polar.customers.deleteExternal({
externalId: "<id>",
});
}
run();declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
$sdk = Polar\Polar::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$response = $sdk->customers->deleteExternal(
externalId: '<id>',
anonymize: false
);
if ($response->statusCode === 200) {
// handle response
}curl --request DELETE \
--url https://api.polar.sh/v1/customers/external/{external_id} \
--header 'Authorization: Bearer <token>'const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.polar.sh/v1/customers/external/{external_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.delete("https://api.polar.sh/v1/customers/external/{external_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.polar.sh/v1/customers/external/{external_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"error": "<string>",
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
You can generate an Organization Access Token from your organization's settings.
Path Parameters
The customer external ID.
Query Parameters
If true, also anonymize the customer's personal data for GDPR compliance.
Response
Customer deleted.
Was this page helpful?
Previous
List Customer Payment MethodsGet saved payment methods of a customer.
**Scopes**: `customers:read` `customers:write`
Next
⌘I
Go (SDK)
package main
import(
"context"
"os"
polargo "github.com/polarsource/polar-go"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New(
polargo.WithSecurity(os.Getenv("POLAR_ACCESS_TOKEN")),
)
res, err := s.Customers.DeleteExternal(ctx, "<id>", polargo.Pointer(false))
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
polar.customers.delete_external(external_id="<id>", anonymize=False)
# Use the SDK ...import { Polar } from "@polar-sh/sdk";
const polar = new Polar({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
await polar.customers.deleteExternal({
externalId: "<id>",
});
}
run();declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
$sdk = Polar\Polar::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$response = $sdk->customers->deleteExternal(
externalId: '<id>',
anonymize: false
);
if ($response->statusCode === 200) {
// handle response
}curl --request DELETE \
--url https://api.polar.sh/v1/customers/external/{external_id} \
--header 'Authorization: Bearer <token>'const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.polar.sh/v1/customers/external/{external_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.delete("https://api.polar.sh/v1/customers/external/{external_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.polar.sh/v1/customers/external/{external_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"error": "<string>",
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}
