Delete a customer
curl --request DELETE \
--url https://api.moflay.com/v1/customers/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.moflay.com/v1/customers/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.moflay.com/v1/customers/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.moflay.com/v1/customers/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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://api.moflay.com/v1/customers/{id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.moflay.com/v1/customers/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.moflay.com/v1/customers/{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{
"id": "cus_GqfKXLmg61LURZhB"
}{
"error": {
"status": 401,
"code": "missing_api_key",
"message": "Missing API key in the authorization header."
}
}{
"error": {
"status": 403,
"code": "invalid_api_key",
"message": "API key is invalid."
}
}{
"error": {
"status": 404,
"code": "not_found",
"message": "The requested endpoint does not exist."
}
}{
"error": {
"status": 405,
"code": "method_not_allowed",
"message": "Method is not allowed for the requested path."
}
}{
"error": {
"status": 422,
"code": "validation_error",
"message": "We found an error with one or more fields in the request.",
"validation": [
{
"field": "email",
"message": "Invalid email format"
},
{
"field": "age",
"message": "Expected number, received string"
}
]
}
}{
"error": {
"status": 429,
"code": "rate_limit_exceeded",
"message": "You have exceeded your request limit. Please try again later."
}
}{
"error": {
"status": 500,
"code": "internal_server_error",
"message": "An unexpected error occurred."
}
}Customers
Delete a customer
Delete a customer by their ID in the organization
Permissions: customers.write
DELETE
/
v1
/
customers
/
{id}
Delete a customer
curl --request DELETE \
--url https://api.moflay.com/v1/customers/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.moflay.com/v1/customers/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.moflay.com/v1/customers/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.moflay.com/v1/customers/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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://api.moflay.com/v1/customers/{id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.moflay.com/v1/customers/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.moflay.com/v1/customers/{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{
"id": "cus_GqfKXLmg61LURZhB"
}{
"error": {
"status": 401,
"code": "missing_api_key",
"message": "Missing API key in the authorization header."
}
}{
"error": {
"status": 403,
"code": "invalid_api_key",
"message": "API key is invalid."
}
}{
"error": {
"status": 404,
"code": "not_found",
"message": "The requested endpoint does not exist."
}
}{
"error": {
"status": 405,
"code": "method_not_allowed",
"message": "Method is not allowed for the requested path."
}
}{
"error": {
"status": 422,
"code": "validation_error",
"message": "We found an error with one or more fields in the request.",
"validation": [
{
"field": "email",
"message": "Invalid email format"
},
{
"field": "age",
"message": "Expected number, received string"
}
]
}
}{
"error": {
"status": 429,
"code": "rate_limit_exceeded",
"message": "You have exceeded your request limit. Please try again later."
}
}{
"error": {
"status": 500,
"code": "internal_server_error",
"message": "An unexpected error occurred."
}
}Authorizations
The API key to use for authentication
Path Parameters
Unique identifier for the customer, prefixed with 'cus_'.
Maximum string length:
255Example:
"cus_GqfKXLmg61LURZhB"
Response
Customer deleted successfully
Customer deleted successfully
Unique identifier for the customer, prefixed with 'cus_'.
Maximum string length:
255Example:
"cus_GqfKXLmg61LURZhB"
Was this page helpful?
⌘I