Skip to main content

Resources API

A resource is a file -- image, document, video, or anything else -- stored with metadata, tags, and relationships to other entities.

List Resources

Retrieve a paginated list of resources with optional filtering.

GET /v1/resources

Query Parameters

ParameterTypeDescription
pageintegerPage number (default: 1)
NamestringFilter by name (partial match)
DescriptionstringFilter by description (partial match)
ContentTypestringFilter by MIME type (e.g., image/jpeg)
OwnerIdintegerFilter by owner group ID
Groupsinteger[]Filter by associated group IDs
Tagsinteger[]Filter by tag IDs
Notesinteger[]Filter by associated note IDs
Idsinteger[]Filter by specific resource IDs
CreatedBeforestringFilter by creation date (ISO 8601)
CreatedAfterstringFilter by creation date (ISO 8601)
OriginalNamestringFilter by original filename
OriginalLocationstringFilter by original file path/URL
HashstringFilter by file hash
ShowWithoutOwnerbooleanOnly show resources without an owner
ShowWithSimilarbooleanOnly show resources with similar images
MinWidthintegerMinimum image width in pixels
MaxWidthintegerMaximum image width in pixels
MinHeightintegerMinimum image height in pixels
MaxHeightintegerMaximum image height in pixels
ResourceCategoryIdintegerFilter by resource category ID
MetaQuerystring[]Filter by metadata conditions (key:value or key:OP:value)
MaxResultsintegerLimit the number of results returned
SortBystring[]Sort order

Example

# List all resources
curl http://localhost:8181/v1/resources

# Filter by content type
curl "http://localhost:8181/v1/resources?ContentType=image/jpeg"

# Filter by owner group
curl "http://localhost:8181/v1/resources?OwnerId=5"

# Filter by tags (multiple)
curl "http://localhost:8181/v1/resources?Tags=1&Tags=2"

# Filter images by dimensions
curl "http://localhost:8181/v1/resources?MinWidth=1920&MinHeight=1080"

Response

[
{
"ID": 1,
"Name": "photo.jpg",
"Description": "A sample photo",
"ContentType": "image/jpeg",
"Hash": "abc123...",
"FileSize": 1024000,
"Width": 1920,
"Height": 1080,
"OriginalName": "IMG_0001.jpg",
"OriginalLocation": "/Users/photos/IMG_0001.jpg",
"OwnerId": 5,
"CreatedAt": "2024-01-15T10:30:00Z",
"UpdatedAt": "2024-01-15T10:30:00Z",
"Tags": [...],
"Owner": {...},
"ResourceCategory": {...},
"Series": {...}
}
]

Get Single Resource

Retrieve details for a specific resource.

GET /v1/resource?id={id}

Example

curl http://localhost:8181/v1/resource?id=123

Upload Resource (File)

Upload one or more files as new resources.

POST /v1/resource
Content-Type: multipart/form-data

Form Parameters

ParameterTypeDescription
resourcefileFile(s) to upload (can be multiple)
NamestringDisplay name for the resource
DescriptionstringDescription text
OwnerIdintegerOwner group ID
Groupsinteger[]Associated group IDs
Tagsinteger[]Tag IDs to apply
Notesinteger[]Note IDs to associate
MetastringJSON metadata object
CategorystringLegacy category string
ContentCategorystringHigh-level content category label
ResourceCategoryIdintegerResource Category ID
OriginalNamestringOriginal filename
OriginalLocationstringOriginal URL/path
WidthintegerManual width override
HeightintegerManual height override
SeriesSlugstringAssign to Series by slug (creates if needed)
SeriesIdintegerAssign to Series by ID

Example

# Upload a single file
curl -X POST http://localhost:8181/v1/resource \
-H "Accept: application/json" \
-F "resource=@/path/to/file.jpg" \
-F "Name=My Photo" \
-F "OwnerId=5" \
-F "Tags=1" \
-F "Tags=2"

# Upload multiple files
curl -X POST http://localhost:8181/v1/resource \
-H "Accept: application/json" \
-F "resource=@/path/to/file1.jpg" \
-F "resource=@/path/to/file2.jpg" \
-F "OwnerId=5"

Response

For a single file upload:

{
"ID": 124,
"Name": "My Photo",
"ContentType": "image/jpeg",
...
}

For multiple file uploads:

[
{"ID": 124, "Name": "file1.jpg", ...},
{"ID": 125, "Name": "file2.jpg", ...}
]

Upload Resource (URL)

Create a resource by downloading from a remote URL.

POST /v1/resource/remote

Parameters

ParameterTypeDescription
URLstringRequired. URL to download from
FileNamestringOverride the filename
NamestringDisplay name
DescriptionstringDescription text
OwnerIdintegerOwner group ID
Groupsinteger[]Associated group IDs
Tagsinteger[]Tag IDs
MetastringJSON metadata
GroupCategoryNamestringAuto-create owner group with this category
GroupNamestringAuto-create owner group with this name
GroupMetastringMetadata for auto-created group

Example

# Download from URL (synchronous)
curl -X POST http://localhost:8181/v1/resource/remote \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"URL": "https://example.com/image.jpg",
"Name": "Downloaded Image",
"OwnerId": 5,
"Tags": [1, 2]
}'

For background downloads, use POST /v1/jobs/download/submit instead. The URL field accepts multiple URLs separated by newlines for batch imports. Legacy alias: POST /v1/download/submit.

Add Local Resource

Add a file that already exists on the server's filesystem.

POST /v1/resource/local

Parameters

ParameterTypeDescription
LocalPathstringRequired. Path within an alternative filesystem
PathNamestringRequired. Storage location key configured via -alt-fs or FILE_ALT_NAME_N
NamestringDisplay name
DescriptionstringDescription text
OwnerIdintegerOwner group ID
Groupsinteger[]Associated group IDs
Tagsinteger[]Tag IDs

Example

curl -X POST http://localhost:8181/v1/resource/local \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"PathName": "archive",
"LocalPath": "/data/existing-file.pdf",
"Name": "Imported Document",
"OwnerId": 5
}'

Edit Resource

Update an existing resource's metadata.

POST /v1/resource/edit

Parameters

ParameterTypeDescription
IDintegerRequired. Resource ID
NamestringNew name
DescriptionstringNew description
OwnerIdintegerNew owner group ID
Groupsinteger[]Replace associated groups
Tagsinteger[]Replace tags
Notesinteger[]Replace associated notes
MetastringReplace metadata JSON
WidthintegerSet width (for images)
HeightintegerSet height (for images)

Example

curl -X POST http://localhost:8181/v1/resource/edit \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"ID": 123,
"Name": "Updated Name",
"Description": "New description",
"Tags": [1, 2, 3]
}'

Delete Resource

Delete a resource and its file.

POST /v1/resource/delete?Id={id}

Example

curl -X POST "http://localhost:8181/v1/resource/delete?Id=123" \
-H "Accept: application/json"

View Resource Content

Returns a 302 Found redirect to the file's storage location (e.g., /files/ab/cd/abcdef1234...). The browser or HTTP client follows the redirect to retrieve the file.

GET /v1/resource/view?id={id}

Example

# Follow the redirect to download the file
curl -L http://localhost:8181/v1/resource/view?id=123 -o downloaded-file.jpg

Get Resource Preview

Get a thumbnail preview of a resource (for images and videos).

GET /v1/resource/preview?ID={id}

Query Parameters

ParameterTypeDescription
IDintegerRequired. Resource ID
WidthintegerDesired thumbnail width
HeightintegerDesired thumbnail height

Example

# Get default thumbnail
curl http://localhost:8181/v1/resource/preview?ID=123 -o thumb.jpg

# Get specific size
curl "http://localhost:8181/v1/resource/preview?ID=123&Width=200&Height=200" -o thumb.jpg

Get Resource Meta Keys

Get all unique metadata keys used across resources.

GET /v1/resources/meta/keys

Example

curl http://localhost:8181/v1/resources/meta/keys

Response

["author", "source", "date_taken", "location"]

Bulk Operations

Bulk Add Tags

Add tags to multiple resources at once.

POST /v1/resources/addTags

Parameters

ParameterTypeDescription
IDinteger[]Resource IDs to modify
EditedIdinteger[]Tag IDs to add

Example

curl -X POST http://localhost:8181/v1/resources/addTags \
-H "Content-Type: application/json" \
-d '{
"ID": [1, 2, 3],
"EditedId": [10, 11]
}'

Bulk Remove Tags, Replace Tags, Add Groups

These endpoints follow the same pattern as Bulk Add Tags, using ID for the resource IDs and EditedId for the entity IDs to add or remove:

EndpointDescription
POST /v1/resources/removeTagsRemove tags from multiple resources
POST /v1/resources/replaceTagsReplace all tags on multiple resources with a new set
POST /v1/resources/addGroupsAdd groups to multiple resources

Bulk Add Metadata

Add or merge metadata to multiple resources.

POST /v1/resources/addMeta

Parameters

ParameterTypeDescription
IDinteger[]Resource IDs to modify
MetastringJSON metadata to merge

Bulk Delete

Delete multiple resources.

POST /v1/resources/delete

Parameters

ParameterTypeDescription
IDinteger[]Resource IDs to delete

Example

curl -X POST http://localhost:8181/v1/resources/delete \
-H "Content-Type: application/json" \
-d '{"ID": [1, 2, 3]}'

Merge Resources

Merge multiple resources into one, combining their metadata and relationships.

POST /v1/resources/merge

Parameters

ParameterTypeDescription
WinnerintegerResource ID to keep
Losersinteger[]Resource IDs to merge and delete

Example

curl -X POST http://localhost:8181/v1/resources/merge \
-H "Content-Type: application/json" \
-d '{
"Winner": 1,
"Losers": [2, 3, 4]
}'

Rotate Image

Rotate an image resource.

POST /v1/resources/rotate

Parameters

ParameterTypeDescription
IDintegerResource ID
DegreesintegerRotation degrees (90, 180, 270)

Example

curl -X POST http://localhost:8181/v1/resources/rotate \
-H "Content-Type: application/json" \
-d '{"ID": 123, "Degrees": 90}'

Recalculate Dimensions

Recalculate width/height for one or more image/video resources.

POST /v1/resource/recalculateDimensions

Parameters

ParameterTypeDescription
IDinteger[]Resource IDs to recalculate

Example

curl -X POST http://localhost:8181/v1/resource/recalculateDimensions \
-H "Content-Type: application/json" \
-d '{"ID": [123, 456]}'

Set Dimensions

Manually set dimensions for a resource.

POST /v1/resources/setDimensions

Parameters

ParameterTypeDescription
IDintegerResource ID
WidthintegerWidth in pixels
HeightintegerHeight in pixels

Inline Editing

Edit resource name or description with minimal payload.

Edit Name

POST /v1/resource/editName?id={id}

Edit Description

POST /v1/resource/editDescription?id={id}

These endpoints accept the new value in the request body.


Resource Versions API

Each resource keeps historical copies of its file. When a new file is uploaded, the previous file is saved as a version.

List Versions

Get all versions for a resource.

GET /v1/resource/versions?resourceId={id}

Query Parameters

ParameterTypeDescription
resourceIdintegerRequired. The resource ID

Example

curl "http://localhost:8181/v1/resource/versions?resourceId=123"

Get Single Version

GET /v1/resource/version?id={versionId}

Query Parameters

ParameterTypeDescription
idintegerRequired. The version ID

Upload New Version

Upload a new file as a version of a resource.

POST /v1/resource/versions?resourceId={id}
Content-Type: multipart/form-data

Parameters

ParameterTypeDescription
resourceIdintegerRequired. The resource ID (query param)
filefileRequired. The file to upload
commentstringOptional comment describing the change

Example

curl -X POST "http://localhost:8181/v1/resource/versions?resourceId=123" \
-H "Accept: application/json" \
-F "file=@/path/to/new-version.jpg" \
-F "comment=Updated resolution"

Restore Version

Restore a previous version as the current resource file.

POST /v1/resource/version/restore

Parameters

ParameterTypeDescription
resourceIdintegerRequired. The resource ID
versionIdintegerRequired. The version ID to restore
commentstringOptional comment for the restore

Example

curl -X POST http://localhost:8181/v1/resource/version/restore \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"resourceId": 123, "versionId": 5, "comment": "Reverting to original"}'

Delete Version

Delete a specific version.

DELETE /v1/resource/version?resourceId={resourceId}&versionId={versionId}

Or using POST:

POST /v1/resource/version/delete?resourceId={resourceId}&versionId={versionId}

Query Parameters

ParameterTypeDescription
resourceIdintegerRequired. The resource ID
versionIdintegerRequired. The version ID

Get Version File

Download the file content of a specific version.

GET /v1/resource/version/file?versionId={versionId}

Query Parameters

ParameterTypeDescription
versionIdintegerRequired. The version ID

Example

curl "http://localhost:8181/v1/resource/version/file?versionId=5" -o version-file.jpg

Cleanup Versions

Remove old versions for a specific resource based on age or count criteria.

POST /v1/resource/versions/cleanup

Parameters

ParameterTypeDescription
resourceIdintegerRequired. The resource ID
keepLastintegerNumber of most recent versions to keep
olderThanDaysintegerDelete versions older than N days
dryRunbooleanIf true, return what would be deleted without deleting

Example

# Preview what would be cleaned up
curl -X POST http://localhost:8181/v1/resource/versions/cleanup \
-H "Content-Type: application/json" \
-d '{"resourceId": 123, "keepLast": 5, "dryRun": true}'

Response

{
"deletedVersionIds": [1, 2, 3],
"count": 3
}

Bulk Cleanup Versions

Remove old versions across multiple resources.

POST /v1/resources/versions/cleanup

Parameters

ParameterTypeDescription
keepLastintegerNumber of most recent versions to keep per resource
olderThanDaysintegerDelete versions older than N days
ownerIdintegerOnly clean up versions for resources owned by this group
dryRunbooleanIf true, return what would be deleted without deleting

Response

{
"deletedByResource": {"123": [1, 2], "456": [3]},
"totalDeleted": 3
}

Compare Versions

Compare two versions of a resource.

GET /v1/resource/versions/compare?resourceId={id}&v1={versionId1}&v2={versionId2}

Same-Resource Comparison

ParameterTypeDescription
resourceIdintegerRequired. The resource ID
v1integerRequired. First version ID
v2integerRequired. Second version ID
curl "http://localhost:8181/v1/resource/versions/compare?resourceId=123&v1=1&v2=5"

Cross-Resource Comparison

Cross-resource comparison is available through the UI at /resource/compare, not through the /v1/ API:

/resource/compare?r1=123&v1=1&r2=456&v2=1

Response

{
"sizeDelta": -1024,
"sameHash": false,
"sameType": true,
"dimensionsDiff": true,
"crossResource": false
}
FieldTypeDescription
sizeDeltaintegerSize difference in bytes (version2 - version1)
sameHashbooleanWhether file hashes match
sameTypebooleanWhether content types match
dimensionsDiffbooleanWhether dimensions differ (width or height)
crossResourcebooleanWhether versions belong to different resources