<?php$url = 'https://api.ayrshare.com/api/profiles';$apiKey = 'API_KEY'; // Replace with your actual API key$profileKey = 'PROFILE_KEY'; // Replace with your actual Profile key$curl = curl_init();curl_setopt_array($curl, [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'DELETE', CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'Authorization: Bearer ' . $apiKey, 'Profile-Key: ' . $profileKey ],]);$response = curl_exec($curl);if (curl_errno($curl)) { echo 'Error:' . curl_error($curl);} else { echo json_encode(json_decode($response), JSON_PRETTY_PRINT);}curl_close($curl);
using System;using System.Net.Http;using System.Threading.Tasks;class Program{ static async Task Main(string[] args) { using var client = new HttpClient(); var requestUri = "https://api.ayrshare.com/api/profiles"; var bearerToken = "Bearer API_KEY"; var profileKey = "PROFILE_KEY"; using var request = new HttpRequestMessage(HttpMethod.Delete, requestUri); request.Headers.Add("Authorization", bearerToken); request.Headers.Add("Profile-Key", profileKey); try { using var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); var responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody); } catch (HttpRequestException e) { Console.WriteLine($"Error: {e.Message}"); } }}
<?php$url = 'https://api.ayrshare.com/api/profiles';$apiKey = 'API_KEY'; // Replace with your actual API key$profileKey = 'PROFILE_KEY'; // Replace with your actual Profile key$curl = curl_init();curl_setopt_array($curl, [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'DELETE', CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'Authorization: Bearer ' . $apiKey, 'Profile-Key: ' . $profileKey ],]);$response = curl_exec($curl);if (curl_errno($curl)) { echo 'Error:' . curl_error($curl);} else { echo json_encode(json_decode($response), JSON_PRETTY_PRINT);}curl_close($curl);
using System;using System.Net.Http;using System.Threading.Tasks;class Program{ static async Task Main(string[] args) { using var client = new HttpClient(); var requestUri = "https://api.ayrshare.com/api/profiles"; var bearerToken = "Bearer API_KEY"; var profileKey = "PROFILE_KEY"; using var request = new HttpRequestMessage(HttpMethod.Delete, requestUri); request.Headers.Add("Authorization", bearerToken); request.Headers.Add("Profile-Key", profileKey); try { using var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); var responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody); } catch (HttpRequestException e) { Console.WriteLine($"Error: {e.Message}"); } }}
{ "action": "post", "status": "error", "code": 144, "message": "Some profiles not found. Please verify the Profile Keys."}
删除你所拥有的 user profile。header 参数中的 Profile Key 即为要删除的 User Profile。
删除 user profile 会永久移除该 profile 及其所有关联的帖子——此操作不可逆,且无法撤销。每秒最多可删除 8 个 user profile,因此在执行批量删除时请合理分散 API 调用,以避免触发速率限制。
每个月的计费周期按该周期内任意单日达到的 user profile 最高数量计费,且不会低于你所在方案包含的最低数量——在处于最低数量时删除 user profile 不会降低费用。这个最高纪录只会上升,不会下降:删除 user profile 可以避免之后的日子把它推得更高,但无法把该周期已经达到的数字降下来,因此在达到最高纪录之后,节省要到下一个计费周期才会体现。这不适用于价格固定的 Launch 方案,也不适用于定制或 Enterprise 协议,后者以协议自身的条款为准。若要查看每日的 user profile 数量,请调用 获取 User Profile 列表 并将 actionLog 设为 true。
Header 参数
Body 参数
string
默认值:"0"
必填
要删除的 User Profile 的标题。若未传入 profileKey,则该字段必填。title 区分大小写,且必须与 User Profile 的标题完全一致。
<?php$url = 'https://api.ayrshare.com/api/profiles';$apiKey = 'API_KEY'; // Replace with your actual API key$profileKey = 'PROFILE_KEY'; // Replace with your actual Profile key$curl = curl_init();curl_setopt_array($curl, [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'DELETE', CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'Authorization: Bearer ' . $apiKey, 'Profile-Key: ' . $profileKey ],]);$response = curl_exec($curl);if (curl_errno($curl)) { echo 'Error:' . curl_error($curl);} else { echo json_encode(json_decode($response), JSON_PRETTY_PRINT);}curl_close($curl);
using System;using System.Net.Http;using System.Threading.Tasks;class Program{ static async Task Main(string[] args) { using var client = new HttpClient(); var requestUri = "https://api.ayrshare.com/api/profiles"; var bearerToken = "Bearer API_KEY"; var profileKey = "PROFILE_KEY"; using var request = new HttpRequestMessage(HttpMethod.Delete, requestUri); request.Headers.Add("Authorization", bearerToken); request.Headers.Add("Profile-Key", profileKey); try { using var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); var responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody); } catch (HttpRequestException e) { Console.WriteLine($"Error: {e.Message}"); } }}