Guests > Disable, enable or delete guest
Delete guest
Endpoint
Section titled “Endpoint”DELETE /organizations/{org_id}/guests/{guest_email}
This removes a guest from your Tallyfy organization, using their email address. It takes the guest off all tasks and ends their link to your organization. If they don’t belong to any other organization, Tallyfy also soft-deletes their guest record.
There’s no restore endpoint for this. You might want to switch a guest’s access off and back on, or delete their account for good. For either one, see disable, enable or delete guest.
Request
Section titled “Request”Replace {org_id} with your organization ID. Replace {guest_email} with the guest’s email address, URL-encoded.
Headers
Section titled “Headers”Authorization: Bearer {your_access_token}Accept: application/jsonX-Tallyfy-Client: APIClient
You don’t need a request body.
Code samples
Section titled “Code samples”const accessToken = 'YOUR_PERSONAL_ACCESS_TOKEN';const orgId = 'YOUR_ORGANIZATION_ID';const guestEmail = "guest.to.delete@example.com";const encodedEmail = encodeURIComponent(guestEmail);const apiUrl = `https://go.tallyfy.com/api/organizations/${orgId}/guests/${encodedEmail}`;
const headers = new Headers();headers.append('Authorization', `Bearer ${accessToken}`);headers.append('Accept', 'application/json');headers.append('X-Tallyfy-Client', 'APIClient');
fetch(apiUrl, { method: 'DELETE', headers: headers}).then(response => { if (response.ok) { return response.json(); } else { return response.json().then(errData => { console.error(`Failed to delete guest. Status: ${response.status}`, errData); throw new Error(`HTTP error! status: ${response.status}`); }); }}).then(data => { console.log('Deleted guest details:'); console.log(JSON.stringify(data, null, 2));}).catch(error => { console.error(`Error deleting guest ${guestEmail}:`, error.message);});import requestsimport jsonimport osfrom urllib.parse import quote
access_token = os.environ.get('TALLYFY_ACCESS_TOKEN', 'YOUR_PERSONAL_ACCESS_TOKEN')org_id = os.environ.get('TALLYFY_ORG_ID', 'YOUR_ORGANIZATION_ID')guest_email = "guest.to.delete@example.com"encoded_email = quote(guest_email)api_url = f'https://go.tallyfy.com/api/organizations/{org_id}/guests/{encoded_email}'
headers = { 'Authorization': f'Bearer {access_token}', 'Accept': 'application/json', 'X-Tallyfy-Client': 'APIClient'}
response = requests.delete(api_url, headers=headers)
if response.status_code == 200: print(f'Successfully deleted guest {guest_email}.') print(json.dumps(response.json(), indent=4))else: print(f'Failed to delete guest. Status: {response.status_code}') print(response.text)import java.net.URI;import java.net.URLEncoder;import java.net.http.HttpClient;import java.net.http.HttpRequest;import java.net.http.HttpResponse;import java.io.IOException;import java.nio.charset.StandardCharsets;
public class DeleteGuest { public static void main(String[] args) { String accessToken = System.getenv().getOrDefault("TALLYFY_ACCESS_TOKEN", "YOUR_PERSONAL_ACCESS_TOKEN"); String orgId = System.getenv().getOrDefault("TALLYFY_ORG_ID", "YOUR_ORGANIZATION_ID"); String guestEmail = "guest.to.delete@example.com"; String encodedEmail = URLEncoder.encode(guestEmail, StandardCharsets.UTF_8); String apiUrl = String.format("https://go.tallyfy.com/api/organizations/%s/guests/%s", orgId, encodedEmail);
HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(apiUrl)) .header("Authorization", "Bearer " + accessToken) .header("Accept", "application/json") .header("X-Tallyfy-Client", "APIClient") .DELETE() .build();
try { HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() == 200) { System.out.println("Successfully deleted guest " + guestEmail); System.out.println("Response:"); System.out.println(response.body()); } else { System.err.println("Failed to delete guest. Status: " + response.statusCode()); System.err.println("Response: " + response.body()); } } catch (IOException | InterruptedException e) { System.err.println("Request failed: " + e.getMessage()); Thread.currentThread().interrupt(); } }}package main
import ( "fmt" "io" "net/http" "net/url" "os" "time")
func main() { accessToken := os.Getenv("TALLYFY_ACCESS_TOKEN") if accessToken == "" { accessToken = "YOUR_PERSONAL_ACCESS_TOKEN" } orgId := os.Getenv("TALLYFY_ORG_ID") if orgId == "" { orgId = "YOUR_ORGANIZATION_ID" } email := "guest.to.delete@example.com"
encodedEmail := url.PathEscape(email) apiUrl := fmt.Sprintf("https://go.tallyfy.com/api/organizations/%s/guests/%s", orgId, encodedEmail)
client := &http.Client{Timeout: 15 * time.Second} req, err := http.NewRequest(http.MethodDelete, apiUrl, nil) if err != nil { fmt.Printf("Error creating request: %v\n", err) return }
req.Header.Set("Authorization", "Bearer "+accessToken) req.Header.Set("Accept", "application/json") req.Header.Set("X-Tallyfy-Client", "APIClient")
resp, err := client.Do(req) if err != nil { fmt.Printf("Error executing request: %v\n", err) return } defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
if resp.StatusCode == http.StatusOK { fmt.Printf("Successfully deleted guest %s\n", email) fmt.Println(string(body)) } else { fmt.Printf("Failed to delete guest. Status: %d\nBody: %s\n", resp.StatusCode, string(body)) }}#include <iostream>#include <string>#include <cpprest/http_client.h>#include <cpprest/json.h>
using namespace web;using namespace web::http;using namespace web::http::client;
pplx::task<void> DeleteTallyfyGuest(const utility::string_t& guestEmail){ utility::string_t accessToken = U("YOUR_PERSONAL_ACCESS_TOKEN"); utility::string_t orgId = U("YOUR_ORGANIZATION_ID"); utility::string_t encodedEmail = uri::encode_data_string(guestEmail); utility::string_t apiUrl = U("https://go.tallyfy.com/api/organizations/") + orgId + U("/guests/") + encodedEmail;
http_client client(apiUrl); http_request request(methods::DEL);
request.headers().add(U("Authorization"), U("Bearer ") + accessToken); request.headers().add(U("Accept"), U("application/json")); request.headers().add(U("X-Tallyfy-Client"), U("APIClient"));
return client.request(request).then([guestEmail](http_response response) { status_code status = response.status_code();
if (status == status_codes::OK) { return response.extract_json().then([guestEmail, status](pplx::task<value> task) { try { value const & body = task.get(); std::wcout << L"Successfully deleted guest. Response:\n" << body.serialize() << std::endl; } catch (const http_exception& e) { std::wcout << L"Deleted guest but couldn't parse response: " << e.what() << std::endl; } }); } else { return response.extract_string().then([status, guestEmail](utility::string_t errorBody) { std::wcerr << L"Failed to delete guest. Status: " << status << std::endl; std::wcerr << L"Response: " << errorBody << std::endl; }); } });}
int main() { try { DeleteTallyfyGuest(U("guest.to.delete@example.com")).wait(); } catch (const std::exception &e) { std::cerr << "Error: " << e.what() << std::endl; } return 0;}// Requires C++ REST SDK (Casablanca)using System;using System.Net.Http;using System.Net.Http.Headers;using System.Threading.Tasks;using System.Text.Json;using System.Web;
public class TallyfyGuestDeleter{ private static readonly HttpClient client = new HttpClient();
public static async Task DeleteGuestAsync(string guestEmail) { var accessToken = Environment.GetEnvironmentVariable("TALLYFY_ACCESS_TOKEN") ?? "YOUR_PERSONAL_ACCESS_TOKEN"; var orgId = Environment.GetEnvironmentVariable("TALLYFY_ORG_ID") ?? "YOUR_ORGANIZATION_ID"; var encodedEmail = HttpUtility.UrlEncode(guestEmail); var apiUrl = $"https://go.tallyfy.com/api/organizations/{orgId}/guests/{encodedEmail}";
try { using var request = new HttpRequestMessage(HttpMethod.Delete, apiUrl); request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken); request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); request.Headers.Add("X-Tallyfy-Client", "APIClient");
HttpResponseMessage response = await client.SendAsync(request); string responseBody = await response.Content.ReadAsStringAsync();
if (response.IsSuccessStatusCode) { Console.WriteLine($"Successfully deleted guest {guestEmail}."); using var doc = JsonDocument.Parse(responseBody); Console.WriteLine(JsonSerializer.Serialize(doc.RootElement, new JsonSerializerOptions { WriteIndented = true })); } else { Console.WriteLine($"Failed to delete guest. Status: {response.StatusCode}"); Console.WriteLine($"Response: {responseBody}"); } } catch (HttpRequestException e) { Console.WriteLine($"Request exception: {e.Message}"); } }
// static async Task Main(string[] args) // { // await DeleteGuestAsync("guest.to.delete@example.com"); // }}Response
Section titled “Response”You’ll get 200 OK. The deleted guest’s details come back in a data object. The guest is taken off all tasks and removed from the organization. If they don’t belong to any other organization, their record is soft-deleted.
If the email isn’t found, you’ll get a 422 validation error. The email must exist in the guests table.
Related articles
Section titled “Related articles”Code Samples > Managing guests
/organizations/[org_id]/guests/[guest_email] updates the…