Skip to main content

📡 API Reference

REST API for the backend. All endpoints under /api/sfdc.

Base URL: http://localhost:8080

Authentication

Include Authorization: Bearer <token> or X-API-Key: <key> header.


Logs

The Logs API provides access to Salesforce debug logs. It supports fetching logs directly from Salesforce, retrieving processed logs from the local database, viewing full log bodies, downloading compressed files, and cleaning up old logs.

Query Apex Logs from Salesforce

Retrieves Apex log headers directly from Salesforce Tooling API. Use this to see the latest logs available in your org before storing them locally.

MethodEndpointDescription
GET/api/sfdc/logsRetrieves Apex log headers from Salesforce Tooling API

Query Parameters:

ParamTypeDefaultDescription
sizeint10Number of records per page
pageint0Page number (0-indexed)

Get Logs from Database

Retrieves processed logs stored in the local PostgreSQL database. Supports filtering by class name and author. Use this for fast, indexed searches without hitting Salesforce limits.

MethodEndpointDescription
GET/api/sfdc/logs/dbRetrieves processed logs stored in local PostgreSQL

Query Parameters:

ParamTypeDefaultDescription
classNamestringFilter by Apex class name
authorstringFilter by author name
sizeint10Number of records per page
pageint0Page number (0-indexed)

Get Log Body

Fetches the full text body of a specific Apex log. Checks local storage first (MinIO), falls back to Salesforce if needed. Use this to read the actual debug output for troubleshooting.

MethodEndpointDescription
GET/api/sfdc/logs/{id}/bodyFetches full text body of a specific Apex log

Download Log File

Downloads the compressed (.gz) log file from storage. Useful for archiving or importing into external analysis tools.

MethodEndpointDescription
GET/api/sfdc/logs/{id}/downloadDownloads compressed (.gz) log file

Query Parameters:

ParamTypeDefaultDescription
operationstringDownload file prefix

Response: application/gzip file

Delete Log

Deletes a specific Apex log from both Salesforce and local storage. Removes the record from the database and the file from MinIO.

MethodEndpointDescription
DELETE/api/sfdc/logs/{id}Deletes a specific Apex log from Salesforce and local storage

Bulk Delete Logs

Deletes multiple logs by ID in a single request. If no IDs are provided, deletes all logs. Use this to clean up storage or remove expired logs in bulk.

MethodEndpointDescription
DELETE/api/sfdc/logsDeletes multiple logs by ID, or all logs if no IDs provided

Query Parameters:

ParamTypeDefaultDescription
idslistList of log IDs to delete. Omit to delete all.

Trace Flags

Trace Flags tell Salesforce to capture debug logs for specific users or classes. This API lets you create, list, and delete trace flags directly through the Salesforce Tooling API.

Create Trace Flag

Creates a new TraceFlag in Salesforce for a target user or class. Specify the time window and log level to control what gets captured.

MethodEndpointDescription
POST/api/sfdc/logs/trace-flagsCreates a new TraceFlag in Salesforce for a target user or class

Request Body:

{
"userId": "005...",
"startTime": "2026-08-25T09:00:00Z",
"endTime": "2026-08-25T17:00:00Z",
"logLevel": "DEBUG",
"recurrence": "DAILY"
}

Response (200):

{
"id": "7tf...",
"success": true,
"errors": []
}

Get Active Trace Flags

Lists all currently active TraceFlags in the Salesforce org. Use this to see what tracing sessions are running right now.

MethodEndpointDescription
GET/api/sfdc/logs/trace-flagsLists all currently active TraceFlags

Get All Trace Flags

Lists all TraceFlags (active and expired) from Salesforce. Useful for auditing past tracing sessions or finding expired flags to clean up.

MethodEndpointDescription
GET/api/sfdc/logs/trace-flags/allLists all TraceFlags (active and expired)

Delete Trace Flag

Deletes a specific TraceFlag from Salesforce. Stops the tracing session immediately.

MethodEndpointDescription
DELETE/api/sfdc/logs/trace-flags/{id}Deletes a specific TraceFlag from Salesforce

Trace Jobs

Trace Jobs are managed tracing sessions that automatically handle Salesforce's 24-hour Trace Flag limit. They use a sliding window to extend trace flags before they expire, ensuring continuous logging without manual intervention.

Create Trace Job

Creates a managed trace job that automatically extends trace flags before they expire. Solves the problem of Salesforce's 24-hour limit by renewing flags on a schedule.

MethodEndpointDescription
POST/api/sfdc/logs/trace-jobsCreates a managed trace job that auto-handles Salesforce's 24-hour limit using sliding window

Request Body: Same as Trace Flag request.

Get All Trace Jobs

Lists all trace jobs with their current status (active, completed, cancelled). Use this to monitor which tracing sessions are running and their history.

MethodEndpointDescription
GET/api/sfdc/logs/trace-jobsLists all trace jobs (active, completed, cancelled)

Query Parameters:

ParamTypeDefaultDescription
targetNamestringFilter by target user name

Adopt Existing Trace Flag

Imports an existing Salesforce TraceFlag as a managed trace job. Use this to take over a trace flag you created manually in Salesforce and let Apexium manage its renewal.

MethodEndpointDescription
POST/api/sfdc/logs/trace-jobs/adoptImports an existing Salesforce TraceFlag as a managed trace job

Request Body:

{
"id": "7tf...",
"tracedEntityId": "005...",
"debugLevelId": "7dl...",
"startDate": "2026-08-25T09:00:00Z",
"expirationDate": "2026-08-25T17:00:00Z"
}

Cancel Trace Job

Cancels a managed trace job and deletes its associated TraceFlag from Salesforce. Stops both the auto-renewal and the active tracing session.

MethodEndpointDescription
DELETE/api/sfdc/logs/trace-jobs/{id}Cancels a managed trace job and deletes its associated TraceFlag

Metadata

The Metadata API tracks Apex classes and triggers in your Salesforce org. It detects changes through scheduled polling, stores body snapshots for comparison, and provides diff views to see exactly what changed between versions.

Get Metadata Details

Retrieves deep details for a specific Apex class or trigger, including code coverage percentage and related test classes. Use this to understand the impact of a class before deployment.

MethodEndpointDescription
GET/api/sfdc/metadata/details/{type}/{id}Deep details for an Apex class or trigger, including coverage and test classes

Path Parameters:

ParamTypeDescription
typestringclass or trigger
idstringSalesforce record ID

Get Metadata History

Returns the change history timeline for a specific Apex class or trigger, ordered newest first. Shows who made each change and when. Use this to track the evolution of a class over time.

MethodEndpointDescription
GET/api/sfdc/metadata/history/{type}/{id}Change history timeline for a specific Apex class or trigger

Get Metadata Diff

Returns a diff between the current body and a specific historical snapshot. Shows exactly what lines were added, removed, or modified. Use this for code review or debugging regressions.

MethodEndpointDescription
GET/api/sfdc/metadata/history/{type}/{id}/diffDiff between current body and a historical snapshot

Query Parameters:

ParamTypeDefaultDescription
historyIdlongID of the historical snapshot to diff

Debug Levels

Debug Levels control the verbosity of Salesforce debug logs. This API lets you view available configurations and search locally stored settings.

Get Debug Levels from Salesforce

Retrieves all available debug configurations directly from Salesforce. Use this to see what log levels are available in your org.

MethodEndpointDescription
GET/api/sfdc/metadata/debug-levelsRetrieves all debug configurations from Salesforce

Query Parameters:

ParamTypeDefaultDescription
sizeint10Records per page
pageint0Page number (0-indexed)

Search Debug Levels in Database

Searches for debug levels stored in the local database. Use this for fast lookups without hitting Salesforce limits.

MethodEndpointDescription
GET/api/sfdc/metadata/debug-levels/dbSearch debug levels stored locally

Query Parameters:

ParamTypeDefaultDescription
namestringFilter by name
sizeint10Records per page
pageint0Page number (0-indexed)

Apex Classes

The Apex Classes API provides access to your Salesforce org's Apex classes. You can fetch directly from Salesforce for real-time data, or search the local database for faster, indexed queries.

Get Apex Classes from Salesforce

Retrieves active Apex classes directly from Salesforce. Use this for the most up-to-date list of classes in your org.

MethodEndpointDescription
GET/api/sfdc/metadata/classesRetrieves active Apex classes from Salesforce

Query Parameters:

ParamTypeDefaultDescription
sizeint10Records per page
pageint0Page number (0-indexed)

Search Apex Classes in Database

Searches for Apex classes stored in the local database. Use this for fast, indexed searches without consuming Salesforce API calls.

MethodEndpointDescription
GET/api/sfdc/metadata/classes/dbSearch Apex classes stored locally

Query Parameters:

ParamTypeDefaultDescription
namestringFilter by class name
sizeint10Records per page
pageint0Page number (0-indexed)

Apex Triggers

The Apex Triggers API provides access to your Salesforce org's Apex triggers. Similar to the Classes API, you can fetch from Salesforce or search the local database.

Get Apex Triggers from Salesforce

Retrieves active Apex triggers directly from Salesforce. Use this for the most current trigger list.

MethodEndpointDescription
GET/api/sfdc/metadata/triggersRetrieves active Apex triggers from Salesforce

Query Parameters:

ParamTypeDefaultDescription
sizeint10Records per page
pageint0Page number (0-indexed)

Search Apex Triggers in Database

Searches for Apex triggers stored in the local database. Use this for fast, indexed searches.

MethodEndpointDescription
GET/api/sfdc/metadata/triggers/dbSearch Apex triggers stored locally

Query Parameters:

ParamTypeDefaultDescription
namestringFilter by trigger name
sizeint10Records per page
pageint0Page number (0-indexed)

Reports

The Reports API accesses Salesforce report metadata. You can list reports, describe their structure, and convert report filters into SOQL queries for programmatic access.

Get Reports from Salesforce

Retrieves report metadata directly from Salesforce. Use this to see what reports are available in your org.

MethodEndpointDescription
GET/api/sfdc/metadata/reportsRetrieves report metadata from Salesforce

Query Parameters:

ParamTypeDefaultDescription
sizeint10Records per page
pageint0Page number (0-indexed)

Search Reports in Database

Searches for report metadata stored in the local database. Use this for fast, indexed searches.

MethodEndpointDescription
GET/api/sfdc/metadata/reports/dbSearch report metadata stored locally

Query Parameters:

ParamTypeDefaultDescription
namestringFilter by report name
sizeint10Records per page
pageint0Page number (0-indexed)

Get Report Describe

Retrieves full report metadata including filters, columns, and groupings from Salesforce Analytics API. Use this to understand a report's structure before querying its data.

MethodEndpointDescription
GET/api/sfdc/metadata/reports/{id}/describeFull report metadata including filters from Salesforce Analytics API

Convert Report to SOQL

Converts report filters into a SOQL query string. Use this to programmatically replicate what a report does in plain SOQL.

MethodEndpointDescription
GET/api/sfdc/metadata/reports/{id}/soqlConverts report filters to a SOQL query string

Users

The Users API provides access to Salesforce user information. Useful for selecting trace flag targets and filtering logs by author.

Get Users from Salesforce

Retrieves active users directly from Salesforce. Use this to populate user selection dropdowns or match logs to specific users.

MethodEndpointDescription
GET/api/sfdc/usersRetrieves active users from Salesforce

Query Parameters:

ParamTypeDefaultDescription
sizeint10Records per page
pageint0Page number (0-indexed)

Search Users in Database

Searches for users stored in the local database. Use this for fast, indexed searches without hitting Salesforce limits.

MethodEndpointDescription
GET/api/sfdc/users/dbSearch users stored locally

Query Parameters:

ParamTypeDefaultDescription
namestringFilter by user name
sizeint10Records per page
pageint0Page number (0-indexed)

Admin

Admin endpoints for managing the application's internal state.

Flush Salesforce Caches

Flushes all Salesforce-related Redis cache keys (sf_tokens, sf_metadata, sf_users). Use this when you suspect stale data or after making changes in Salesforce that aren't reflected in the app.

MethodEndpointDescription
POST/admin/cache/flushFlushes all Salesforce-related Redis cache keys (sf_tokens, sf_metadata, sf_users)

Response (200):

{
"message": "All Salesforce caches flushed successfully",
"activeOrgId": "00D..."
}

Interactive Documentation

When the backend is running, explore the full API interactively:

  • Swagger UI: http://localhost:8080/swagger-ui.html
  • OpenAPI Spec: http://localhost:8080/v3/api-docs