Export organization members as a CSV file. #### Path Parameters **`organization_id`** string required Organization ID #### Request Body **`search_term`** string optional Search filter **`role_id`** string optional Role filter **`status_id`** string optional Status filter **`include_deleted`** boolean optional Include soft-deleted members **`sort_by`** string optional Field to sort by (e.g., `name`, `email`, `created_at`) **`sort_order`** string optional Sort order: `asc` or `desc` ## Returns Returns a CSV file with member data. - Content-Type: `text/csv` - Content-Disposition: `attachment; filename="members_{organization_id}.csv"` ## Notes - Limited to 10,000 records per export - Filters are applied before export - Returns error if limit exceeded ## Authorization Requires Admin or Owner role. ```bash curl -X POST https://api.aitronos.com/v1/organizations/org_abc123/users/export-csv \ -H "X-API-Key: $FREDDY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "search_term": "john", "role_id": "role_abc123" }' \ --output members.csv ``` ```python import requests import os api_key = os.environ["FREDDY_API_KEY"] org_id = "org_abc123" response = requests.post( f"https://api.aitronos.com/v1/organizations/{org_id}/users/export-csv", headers={ "X-API-Key": api_key, "Content-Type": "application/json" }, json={ "search_term": "john", "role_id": "role_abc123" } ) with open("members.csv", "wb") as f: f.write(response.content) ``` ```javascript const response = await fetch('https://api.aitronos.com/v1/organizations/org_abc123/users/export-csv', { method: 'POST', headers: { 'Authorization': `Bearer ${process.env.FREDDY_API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ search_term: 'john', role_id: 'role_abc123' }) }); const blob = await response.blob(); ``` **Response:** 200 OK ```csv Full Name,Email,Username,Role,Status,Joined At,Created At,Last Modified At John Doe,john@example.com,johndoe,Admin,Active,2025-01-15T10:30:00Z,2025-01-15T10:30:00Z,2025-01-20T14:45:00Z ```