Filtering & Sorting
Filter and sort list endpoints to find specific resources.
Query Parameters
Common Parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
q | string | Search/filter query | ?q=meeting |
sort | string | Field to sort by | ?sort=created_at |
direction | string | Sort direction | ?direction=desc |
Filtering with Search
Use the q parameter to search across fields:
# Search sessions
GET /api/v3/speech-to-text/session?q=meeting
# Search folders
GET /api/v3/folders?q=quarterly
# URL-encoded search
GET /api/v3/speech-to-text/session?q=quarterly%20meeting%202025
Python Examples
import requests
# Simple search
sessions = requests.get(
'https://api.scriptix.io/api/v3/speech-to-text/session',
headers={'Authorization': 'Bearer YOUR_TOKEN'},
params={'q': 'meeting'}
).json()
# URL encoding handled automatically
query = "quarterly meeting 2025"
sessions = requests.get(
'https://api.scriptix.io/api/v3/speech-to-text/session',
headers={'Authorization': 'Bearer YOUR_TOKEN'},
params={'q': query}
).json()
Sorting
Sort Parameters
| Parameter | Description | Values |
|---|---|---|
sort | Field to sort by | created_at, name, updated_at, etc. |
direction | Sort direction | asc (ascending) or desc (descending) |
Default Sorting
Without sort parameters, most endpoints sort by created_at descending (newest first).
Sort Examples
# Newest first (default for most endpoints)
GET /api/v3/speech-to-text/session?sort=created_at&direction=desc
# Oldest first
GET /api/v3/speech-to-text/session?sort=created_at&direction=asc
# Alphabetical by name
GET /api/v3/folders?sort=name&direction=asc
# Recently updated
GET /api/v3/custom_models?sort=last_modified&direction=desc
Python Examples
# Sort by creation date (newest first)
sessions = requests.get(
'https://api.scriptix.io/api/v3/speech-to-text/session',
headers={'Authorization': 'Bearer YOUR_TOKEN'},
params={'sort': 'created_at', 'direction': 'desc'}
).json()
# Sort by name (A-Z)
folders = requests.get(
'https://api.scriptix.io/api/v3/folders',
headers={'Authorization': 'Bearer YOUR_TOKEN'},
params={'sort': 'name', 'direction': 'asc'}
).json()
Combining Filters, Sorting, and Pagination
GET /api/v3/speech-to-text/session?q=meeting&sort=created_at&direction=desc&offset=0&limit=50
sessions = requests.get(
'https://api.scriptix.io/api/v3/speech-to-text/session',
headers={'Authorization': 'Bearer YOUR_TOKEN'},
params={
'q': 'meeting',
'sort': 'created_at',
'direction': 'desc',
'offset': 0,
'limit': 50
}
).json()
Endpoint-Specific Filtering
Some endpoints support additional filters:
Folders
# Filter by parent folder
GET /api/v3/folders?q=project&sort=name&direction=asc
Custom Models
# Search custom models
GET /api/v3/custom_models?q=medical&sort=last_modified&direction=desc
Sessions
# Search transcription sessions
GET /api/v3/speech-to-text/session?q=interview&sort=created_at&direction=desc
Tokens
# Search API tokens
GET /api/v3/tokens?q=batch&sort=created_at&direction=desc
Sortable Fields by Endpoint
Speech-to-Text Sessions
created_at- Creation date/timefilename- File nameduration- Audio durationstatus- Processing status
Folders
name- Folder namecreated_at- Creation date/timeupdated_at- Last modified date/time
Custom Models
name- Model namecreated_at- Creation date/timelast_modified- Last training/update
Subscriptions
created_at- Subscription start datestatus- Subscription status
Invoices
created_at- Invoice dateamount- Invoice amountstatus- Payment status
Best Practices
1. Use Server-Side Filtering
# ❌ Fetch all and filter client-side
all_sessions = get_all_sessions()
meetings = [s for s in all_sessions if 'meeting' in s['filename'].lower()]
# ✅ Filter server-side
meetings = requests.get(
'https://api.scriptix.io/api/v3/speech-to-text/session',
headers={'Authorization': 'Bearer YOUR_TOKEN'},
params={'q': 'meeting'}
).json()
2. Combine Multiple Parameters
Narrow results with search + sort + pagination:
sessions = requests.get(
'https://api.scriptix.io/api/v3/speech-to-text/session',
headers={'Authorization': 'Bearer YOUR_TOKEN'},
params={
'q': 'meeting',
'sort': 'created_at',
'direction': 'desc',
'offset': 0,
'limit': 25
}
).json()
3. Use Appropriate Sorting
Sort by most relevant field:
# For recent activity
params = {'sort': 'updated_at', 'direction': 'desc'}
# For chronological order
params = {'sort': 'created_at', 'direction': 'asc'}
# For alphabetical lists
params = {'sort': 'name', 'direction': 'asc'}
4. URL Encode Search Queries
import urllib.parse
# Spaces and special characters are automatically encoded
query = "Q1 2025 meeting"
# Becomes: Q1%202025%20meeting
Advanced Filtering Examples
Find Recent Sessions
# Get sessions from last week, sorted by creation date
sessions = requests.get(
'https://api.scriptix.io/api/v3/speech-to-text/session',
headers={'Authorization': 'Bearer YOUR_TOKEN'},
params={
'sort': 'created_at',
'direction': 'desc',
'limit': 50
}
).json()
Search and Sort
# Search for "interview" and sort alphabetically
sessions = requests.get(
'https://api.scriptix.io/api/v3/speech-to-text/session',
headers={'Authorization': 'Bearer YOUR_TOKEN'},
params={
'q': 'interview',
'sort': 'filename',
'direction': 'asc'
}
).json()
JavaScript Examples
// Search with fetch
const searchSessions = async (query) => {
const params = new URLSearchParams({
q: query,
sort: 'created_at',
direction: 'desc',
offset: 0,
limit: 25
});
const response = await fetch(
`https://api.scriptix.io/api/v3/speech-to-text/session?${params}`,
{
headers: { 'Authorization': 'Bearer YOUR_TOKEN' }
}
);
return await response.json();
};
// Usage
const results = await searchSessions('meeting');
Related Documentation
- Pagination - Paginate through results
- API Overview - API introduction
- Rate Limits - API rate limiting