Skip to main content

Tags API

Manage tags for organizing nodes and files.

Endpoints

POST /tags

POST Create a new tag.

curl -X POST "https://api.ofself.ai/api/v1/tags" \
-H "X-API-Key: your-key" \
-H "X-User-ID: user-123" \
-H "Content-Type: application/json" \
-d '{
"name": "Work",
"color": "#3B82F6"
}'

Request Body:

FieldTypeRequiredDescription
namestringYesTag name (1-100 characters)
colorstringNoHex color code (#RRGGBB)
categorystringNoCategory (e.g., topic, person, location)
descriptionstringNoTag description
parent_tag_idUUIDNoParent tag for hierarchical tags

Response: 201 Created

{
"id": "tag_work123",
"name": "Work",
"color": "#3B82F6",
"owner_id": "user-123",
"created_at": "2024-01-15T10:30:00Z"
}

GET /tags

GET List all tags.

curl -X GET "https://api.ofself.ai/api/v1/tags" \
-H "X-API-Key: your-key" \
-H "X-User-ID: user-123"

Query Parameters:

ParameterTypeDescription
searchstringSearch tag names
categorystringFilter by category
parent_tag_idUUIDFilter by parent tag
accessstringowned, shared, or all (default)
include_nodesbooleanInclude associated nodes (default: false)
viewstringGraph view filter: identity (default) or neutral
pageintegerPage number (default: 1)
per_pageintegerItems per page (default: 50, max: 200)

GET /tags/:tag_id

GET Get a single tag.

curl -X GET "https://api.ofself.ai/api/v1/tags/tag_work" \
-H "X-API-Key: your-key" \
-H "X-User-ID: user-123"

PUT /tags/:tag_id

PUT Update a tag.

curl -X PUT "https://api.ofself.ai/api/v1/tags/tag_work" \
-H "X-API-Key: your-key" \
-H "X-User-ID: user-123" \
-H "Content-Type: application/json" \
-d '{
"name": "Work Projects",
"color": "#22C55E"
}'

DELETE /tags/:tag_id

DELETE Delete a tag.

curl -X DELETE "https://api.ofself.ai/api/v1/tags/tag_work" \
-H "X-API-Key: your-key" \
-H "X-User-ID: user-123"

Note: This removes the tag but doesn't delete nodes with this tag.


POST /tags/bulk-delete

POST Delete multiple tags at once.

curl -X POST "https://api.ofself.ai/api/v1/tags/bulk-delete" \
-H "X-API-Key: your-key" \
-H "X-User-ID: user-123" \
-H "Content-Type: application/json" \
-d '{
"tag_ids": ["tag-uuid-1", "tag-uuid-2", "tag-uuid-3"]
}'

Request Body:

FieldTypeRequiredDescription
tag_idsarrayYesArray of tag UUIDs to delete

Response: 200 OK

{
"deleted_count": 2,
"not_found_ids": ["tag-uuid-3"],
"message": "Successfully deleted 2 tag(s)"
}

GET /tags/:tag_id/nodes

GET Get all nodes with a specific tag.

curl -X GET "https://api.ofself.ai/api/v1/tags/tag_work/nodes" \
-H "X-API-Key: your-key" \
-H "X-User-ID: user-123"

GET /tags/:tag_id/files

GET Get all files with a specific tag.

curl -X GET "https://api.ofself.ai/api/v1/tags/tag_work/files" \
-H "X-API-Key: your-key" \
-H "X-User-ID: user-123"

Third-Party Tag Creation

POST /third-party/tags

POST Create a tag on behalf of a user. Requires the app to have tags.create or tags.write permission.

curl -X POST "https://api.ofself.ai/api/v1/third-party/tags" \
-H "X-API-Key: your-key" \
-H "Content-Type: application/json" \
-d '{
"name": "quarterly-review",
"category": "business",
"color": "#3498db",
"description": "Quarterly review documents"
}'

Request Body:

FieldTypeRequiredDescription
namestringYesTag name
categorystringNoTag category
colorstringNoHex color code
descriptionstringNoTag description

Response: 201 Created

No X-User-ID Header

This endpoint derives the user from the API key's authorization. The X-User-ID header is not needed.

Errors:

  • 403 PERMISSION_DENIED — App doesn't have tags.create or tags.write permission
  • 409 — Tag with this name already exists for the user