Automatically Cancel Subscription Plan
Overview
This endpoint allows you to cancel subscription for a particular api key automatically.
Request
--request POST 'https://stablediffusionapi.com/api/v3/cancel_subscription' \
caution
Before calling this endpoint, you must have purchased subscription via this endpoint
Send a POST
request to https://stablediffusionapi.com/api/v3/cancel_subscription endpoint and pass the desired key_to_cancel .
Attributes
Parameter | Type | Description |
---|---|---|
key | String | Your default API Key used for request authorization |
key_to_cancel | String | The api custom api key you want to cancel the subscription for |
Example
Body
Body Raw
{
"key":"your-default-api-key",
"key_to_cancel":"a2cSbgGXIqAHtr3iDBpCdb1yVLZZk000cCltCTtUNpkRM45mak5SpLY9gAlR"
}
Request
- JS
- PHP
- NODE
- PYTHON
- JAVA
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"key": "",
"key_to_cancel":"a2cSbgGXIqAHtr3iDBpCdb1yVLZZk000cCltCTtUNpkRM45mak5SpLY9gAlR"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://stablediffusionapi.com/api/v3/cancel_subscription", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
<?php
$payload = [
"key" => "",
"key_to_cancel" => "a2cSbgGXIqAHtr3iDBpCdb1yVLZZk000cCltCTtUNpkRM45mak5SpLY9gAlR"
];
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://stablediffusionapi.com/api/v3/cancel_subscription',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://stablediffusionapi.com/api/v3/cancel_subscription',
'headers': {
'Content-Type': 'application/json'
},
body: JSON.stringify({
"key": "",
"key_to_cancel":"a2cSbgGXIqAHtr3iDBpCdb1yVLZZk000cCltCTtUNpkRM45mak5SpLY9gAlR"
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
import requests
import json
url = "https://stablediffusionapi.com/api/v3/cancel_subscription"
payload = json.dumps({
"key": "",
"key_to_cancel":"a2cSbgGXIqAHtr3iDBpCdb1yVLZZk000cCltCTtUNpkRM45mak5SpLY9gAlR"
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"key\": \"\",\n \"key_to_cancel\": \"a2cSbgGXIqAHtr3iDBpCdb1yVLZZk000cCltCTtUNpkRM45mak5SpLY9gAlR\"\n}");
Request request = new Request.Builder()
.url("https://stablediffusionapi.com/api/v3/cancel_subscription")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
Response
{
"status": "success",
"messege": "subscription cancelled successfully"
}