Definitions
Manage definitions nested under acronyms — add, edit, delete, restore
Definitions API
Definitions are the core content of define.wtf. Each acronym has one or more definitions contributed by team members. Definitions can be voted on, categorized, and tagged.
List Definitions
GET /api/v1/acronyms/{acronymId}/definitions
Returns all active definitions for a specific acronym, ordered by primary status and vote count.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| acronymId | string | Yes | The acronym ID (e.g., acr_abc123def456) |
Response
{
"success": true,
"data": [
{
"id": "def_xyz789",
"acronymId": "acr_abc123def456",
"title": "Application Programming Interface",
"text": "A set of protocols and tools for building software applications.",
"isPrimary": true,
"netVotes": 12,
"upvotes": 14,
"downvotes": 2,
"userVote": 1,
"createdBy": "user_123",
"creatorName": "Alice Chen",
"creatorAvatar": "https://avatar.example.com/alice.jpg",
"departmentContext": "Engineering",
"tags": ["standard", "http", "technology"],
"categories": [
{
"id": "cat_001",
"name": "Technology",
"slug": "technology",
"color": "#FF6B6B"
}
],
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
},
{
"id": "def_abc456",
"acronymId": "acr_abc123def456",
"title": "Advanced Programmable Interface",
"text": "Alternative interpretation.",
"isPrimary": false,
"netVotes": -2,
"upvotes": 1,
"downvotes": 3,
"userVote": null,
"createdBy": "user_456",
"creatorName": "Bob Smith",
"creatorAvatar": "https://avatar.example.com/bob.jpg",
"departmentContext": null,
"tags": [],
"categories": [],
"createdAt": "2024-01-17T14:20:00Z",
"updatedAt": "2024-01-17T14:20:00Z"
}
]
}Example
curl https://engineering.define.wtf/api/v1/acronyms/acr_abc123def456/definitions \
-H "Cookie: next-auth.session-token=YOUR_TOKEN"Create Definition
POST /api/v1/acronyms/{acronymId}/definitions
Adds a new definition to an existing acronym.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| acronymId | string | Yes | The acronym ID (e.g., acr_abc123def456) |
Request Body
{
"title": "Advanced Programmable Interface",
"text": "Alternative interpretation used in specialized contexts.",
"categoryIds": ["cat_001"],
"departmentContext": "Research",
"tags": ["research", "experimental"]
}Body Parameters
| Field | Type | Required | Max Length | Description |
|---|---|---|---|---|
| title | string | Yes | 500 | Definition title |
| text | string | No | 5000 | Full definition text (defaults to title) |
| categoryIds | array | No | — | Category IDs to assign |
| departmentContext | string | No | 200 | Department or context hint |
| tags | array | No | 10 tags max, 50 chars each | Tags for this definition |
Response
Returns 201 Created:
{
"success": true,
"data": {
"id": "def_new123",
"acronymId": "acr_abc123def456",
"title": "Advanced Programmable Interface",
"text": "Alternative interpretation used in specialized contexts.",
"isPrimary": false,
"netVotes": 0,
"upvotes": 0,
"downvotes": 0,
"createdBy": "user_789",
"departmentContext": "Research",
"tags": ["research", "experimental"],
"categories": [
{
"id": "cat_001",
"name": "Technology",
"slug": "technology",
"color": "#FF6B6B"
}
],
"createdAt": "2024-01-21T13:45:00Z",
"updatedAt": "2024-01-21T13:45:00Z"
}
}Example
curl -X POST https://engineering.define.wtf/api/v1/acronyms/acr_abc123def456/definitions \
-H "Cookie: next-auth.session-token=YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Advanced Programmable Interface",
"text": "Alternative interpretation used in specialized contexts.",
"categoryIds": ["cat_001"],
"departmentContext": "Research",
"tags": ["research", "experimental"]
}'Update Definition
PATCH /api/v1/acronyms/{acronymId}/definitions/{defId}
Updates an existing definition's content.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| acronymId | string | Yes | The acronym ID |
| defId | string | Yes | The definition ID |
Request Body
{
"title": "Advanced Programmable Interface",
"text": "Updated definition text.",
"categoryIds": ["cat_001", "cat_002"],
"departmentContext": "Product",
"tags": ["research", "api", "updated"]
}Body Parameters
| Field | Type | Description |
|---|---|---|
| title | string | Updated title |
| text | string | Updated text |
| categoryIds | array | New categories |
| departmentContext | string | Updated context |
| tags | array | Updated tags |
Response
Returns 200 OK:
{
"success": true,
"data": {
"id": "def_abc456",
"acronymId": "acr_abc123def456",
"title": "Advanced Programmable Interface",
"text": "Updated definition text.",
"isPrimary": false,
"netVotes": -2,
"upvotes": 1,
"downvotes": 3,
"categoryIds": ["cat_001", "cat_002"],
"departmentContext": "Product",
"tags": ["research", "api", "updated"],
"updatedAt": "2024-01-21T14:00:00Z"
}
}Example
curl -X PATCH https://engineering.define.wtf/api/v1/acronyms/acr_abc123def456/definitions/def_abc456 \
-H "Cookie: next-auth.session-token=YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Advanced Programmable Interface",
"text": "Updated definition text.",
"tags": ["research", "api", "updated"]
}'Delete Definition (Soft Delete)
DELETE /api/v1/acronyms/{acronymId}/definitions/{defId}
Soft-deletes a definition. It remains in the database but is hidden from queries. If this is the only active definition, the acronym remains but shows no definitions.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| acronymId | string | Yes | The acronym ID |
| defId | string | Yes | The definition ID |
Response
Returns 204 No Content (no response body).
Example
curl -X DELETE https://engineering.define.wtf/api/v1/acronyms/acr_abc123def456/definitions/def_abc456 \
-H "Cookie: next-auth.session-token=YOUR_TOKEN"Delete Definition (Hard Delete)
DELETE /api/v1/acronyms/{acronymId}/definitions/{defId}?permanent=true
Permanently removes a definition from the database. Only admins and owners can perform hard deletes.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| acronymId | string | Yes | The acronym ID |
| defId | string | Yes | The definition ID |
| permanent | boolean | No | Set to true to hard-delete |
Response
Returns 204 No Content (no response body).
Permissions
- Admin/Owner only
Example
curl -X DELETE "https://engineering.define.wtf/api/v1/acronyms/acr_abc123def456/definitions/def_abc456?permanent=true" \
-H "Cookie: next-auth.session-token=YOUR_TOKEN"Restore Definition
POST /api/v1/acronyms/{acronymId}/definitions/{defId}/restore
Restores a soft-deleted definition.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| acronymId | string | Yes | The acronym ID |
| defId | string | Yes | The definition ID |
Response
Returns 200 OK:
{
"success": true,
"data": {
"id": "def_abc456",
"acronymId": "acr_abc123def456",
"title": "Advanced Programmable Interface",
"text": "Alternative interpretation.",
"isPrimary": false,
"isRestored": true,
"restoredAt": "2024-01-21T15:30:00Z"
}
}Example
curl -X POST https://engineering.define.wtf/api/v1/acronyms/acr_abc123def456/definitions/def_abc456/restore \
-H "Cookie: next-auth.session-token=YOUR_TOKEN"Definition Fields Reference
| Field | Type | Description |
|---|---|---|
| id | string | Unique definition ID (prefixed with def_) |
| acronymId | string | Parent acronym ID |
| title | string | Definition title/heading |
| text | string | Full definition text |
| isPrimary | boolean | Is this the primary definition? |
| netVotes | number | Upvotes - downvotes |
| upvotes | number | Count of upvotes |
| downvotes | number | Count of downvotes |
| userVote | number | null | Current user's vote (1, -1, or null) |
| createdBy | string | User ID of creator |
| creatorName | string | Name of creator |
| creatorAvatar | string | null | Avatar URL of creator |
| departmentContext | string | null | Department hint |
| tags | array | String tags |
| categories | array | Category objects |
| createdAt | string | ISO 8601 creation timestamp |
| updatedAt | string | ISO 8601 update timestamp |
| deletedAt | string | null | ISO 8601 soft-delete timestamp (admin only) |
Error Responses
Definition not found (404):
{
"success": false,
"error": {
"code": "DEFINITION_NOT_FOUND",
"message": "Definition not found"
}
}Acronym not found (404):
{
"success": false,
"error": {
"code": "ACRONYM_NOT_FOUND",
"message": "Acronym not found"
}
}Profanity detected (400):
{
"success": false,
"error": {
"code": "PROFANITY_DETECTED",
"message": "Content contains inappropriate language",
"details": {
"fields": ["title", "tags"]
}
}
}Insufficient permissions (403):
{
"success": false,
"error": {
"code": "FORBIDDEN",
"message": "You do not have permission to perform this action"
}
}