Python SDK
from metrifox_sdk import MetrifoxClient
client = MetrifoxClient(api_key="your_api_key")
# Delete a customer
customer_key = "your_customer_unique_id"
response = client.customers.delete(customer_key)
import { init } from "metrifox-js";
const metrifoxClient = init({
apiKey: process.env.METRIFOX_API_KEY
});
// Delete a customer
const customerKey = 'your_customer_unique_id';
const response = await metrifoxClient.customers.delete(customerKey);
require 'metrifox-sdk'
# Initialize with configuration
METRIFOX_SDK = MetrifoxSDK.init({ api_key: "your-api-key" })
# Delete a customer
response = METRIFOX_SDK.customers.delete_customer({ customer_key: 'your_customer_unique_id' })
curl --request DELETE \
--url https://{defaultHost}/api/v1/customers/{customer_key} \
--header 'x-api-key: <api-key>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{defaultHost}/api/v1/customers/{customer_key}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{defaultHost}/api/v1/customers/{customer_key}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://{defaultHost}/api/v1/customers/{customer_key}")
.header("x-api-key", "<api-key>")
.asString();{
"message": "Customer deleted successfully"
}{
"message": "<string>",
"errors": {}
}{
"message": "Customer not found",
"errors": {
"customer_key": [
"Customer with key 'acme-corp-001' does not exist"
]
}
}{
"message": "Customer cannot be deleted",
"errors": {
"reason": [
"Customer has active subscriptions or outstanding invoices"
]
}
}Customers
Delete a Customer
Deletes a customer with given customer key
DELETE
/
api
/
v1
/
customers
/
{customer_key}
Python SDK
from metrifox_sdk import MetrifoxClient
client = MetrifoxClient(api_key="your_api_key")
# Delete a customer
customer_key = "your_customer_unique_id"
response = client.customers.delete(customer_key)
import { init } from "metrifox-js";
const metrifoxClient = init({
apiKey: process.env.METRIFOX_API_KEY
});
// Delete a customer
const customerKey = 'your_customer_unique_id';
const response = await metrifoxClient.customers.delete(customerKey);
require 'metrifox-sdk'
# Initialize with configuration
METRIFOX_SDK = MetrifoxSDK.init({ api_key: "your-api-key" })
# Delete a customer
response = METRIFOX_SDK.customers.delete_customer({ customer_key: 'your_customer_unique_id' })
curl --request DELETE \
--url https://{defaultHost}/api/v1/customers/{customer_key} \
--header 'x-api-key: <api-key>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{defaultHost}/api/v1/customers/{customer_key}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{defaultHost}/api/v1/customers/{customer_key}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://{defaultHost}/api/v1/customers/{customer_key}")
.header("x-api-key", "<api-key>")
.asString();{
"message": "Customer deleted successfully"
}{
"message": "<string>",
"errors": {}
}{
"message": "Customer not found",
"errors": {
"customer_key": [
"Customer with key 'acme-corp-001' does not exist"
]
}
}{
"message": "Customer cannot be deleted",
"errors": {
"reason": [
"Customer has active subscriptions or outstanding invoices"
]
}
}⌘I

