FileRelay
Documentation
Try our Sandbox

RFC Remote Execution API

API endpoints for invoking SAP BAPIs and remote-enabled function modules through the FileRelay JCo bridge.

RFC Remote Execution API

The RFC API lets you invoke SAP remote-enabled function modules (BAPIs) through FileRelay's JCo bridge. This is the same channel FileRelay uses internally to enrich documents with SAP business-object metadata.

Each workspace's on-prem connector hosts a JCo connection pool to the configured SAP system. The cloud API authenticates the caller, forwards the call over the connector tunnel, captures the result and the JCo trace, and returns both.

Connector requirement. RFC endpoints require a running connector with JCo enabled. See SAP Connection for setup.

Authorization

Authenticate with a Sanctum bearer token (Authorization: Bearer <token>) issued for your user. The token is bound to your user and workspace membership — a token issued for workspace A cannot call into workspace B, and tokens can optionally carry a workspace:<id> ability pinning them to one workspace.

RFC calls execute under the SAP service account configured in the connector (sap.jco.user). The token only governs whether a workspace member is allowed to trigger a call; SAP authorisations (S_RFC, transaction codes, table reads) are enforced by SAP for that service user.

Workspace Role Can do
Owner / Admin / Member POST .../rfc/call, plus status and logs

Any workspace member can invoke calls; team management and workspace settings stay owner/admin. The dashboard RFC console follows the same rule.

JCo Connection Status

Check whether the workspace's connector has an active JCo session before issuing calls.

GET /api/{workspaceSlug}/rfc/status

Example Request

curl -X GET "https://filerelay.dev/api/acme/production/rfc/status" \
  -H "Authorization: Bearer fr_live_abc123def456" \
  -H "Accept: application/json"

Example Response

{
  "data": {
    "enabled": true,
    "connected": true,
    "ashost": "sap-prd.acme.internal",
    "sysnr": "00",
    "client": "100",
    "user": "FILERELAY_RFC",
    "lang": "EN",
    "pool": {
      "capacity": 5,
      "peak_limit": 10,
      "in_use": 1,
      "idle": 4
    },
    "last_call_at": "2026-04-04T10:29:00Z"
  }
}

If enabled is false, JCo is not configured on this connector and all calls to POST .../rfc/call will return 409 Conflict.

Invoke an RFC

Execute any remote-enabled function module by raw name.

POST /api/{workspaceSlug}/rfc/call

Request Body

Field Type Required Description
function_module string Yes Raw ABAP function module name (max 64 chars)
parameters object No Input parameters passed to the function module
tables object No Table parameters (each value is an array of rows)
destination string No Named JCo destination override (max 64 chars)
timeout_ms integer No Per-call timeout in milliseconds (min 1000, max 300000)
whitelist array No Dot-paths to keep in result (e.g. NAME, ITEMS[*].MATERIAL). Empty/absent = keep everything.
blacklist array No Dot-paths to strip from result (e.g. PASSWORD, RETURN). Wins on overlap.

Result shaping

The whitelist/blacklist run server-side only, in a fixed order — the same as the RFC console:

  1. BAPI errors (TYPE: E/A rows) are extracted into bapiErrors first, so blacklisting RETURN can never hide a real SAP error.
  2. The whitelist picks which fields survive (empty = everything).
  3. The blacklist strips from whatever survived (blacklist wins on overlap).

The raw pre-filter payload is dropped server-side and never traverses the wire.

Example Request

curl -X POST "https://filerelay.dev/api/acme/production/rfc/call" \
  -H "Authorization: Bearer [REDACTED]" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "function_module": "BAPI_USER_GET_DETAIL",
    "parameters": {
      "USERNAME": "JOHN_DOE"
    },
    "whitelist": ["USERNAME", "FULLNAME", "RETURN"],
    "blacklist": ["RETURN"]
  }'

Example Response (Success)

{
  "data": {
    "success": true,
    "result": {
      "USERNAME": "JOHN_DOE",
      "FULLNAME": "John Doe"
    },
    "bapiErrors": []
  }
}

result reflects the whitelist/blacklist above (RETURN was stripped server-side). bapiErrors always carries the extracted TYPE: E/A messages, even when RETURN itself is filtered out.

Example Response (Failure)

{
  "data": {
    "success": false,
    "error": "JCo bridge unreachable: cURL error 7: Failed to connect"
  }
}

Always returns 200 OK at the HTTP level (except 401/403/422/429 for auth, validation, and rate limits) — check data.success for the call outcome. Transport failures to the connector surface as {"success": false, "error": "..."} inside data.

JCo Trace Logs

Tail the most recent JCo trace lines from the connector. Useful when a call returns an opaque error and you need to see the raw RFC trace.

GET /api/{workspaceSlug}/rfc/logs

Query Parameters

Parameter Type Description Default
limit integer Number of trailing lines to return (max 500) 200
since string ISO 8601 timestamp -- return lines after this --

Example Request

curl -X GET "https://filerelay.dev/api/acme/production/rfc/logs?limit=50" \
  -H "Authorization: Bearer fr_live_abc123def456" \
  -H "Accept: application/json"

Example Response

{
  "data": {
    "lines": [
      "2026-04-04 10:30:01.087 [pool-1-thread-3] DEBUG JCo  >> BAPI_DOCUMENT_GETDETAIL2 DOC_ID=4A3F...",
      "2026-04-04 10:30:01.174 [pool-1-thread-3] DEBUG JCo  << RETURN.TYPE=S MESSAGE=OK"
    ],
    "truncated": false
  }
}

List Recent RFC Calls

All RFC calls made through this API are persisted as captured_requests with channel: "jco". Query them through the Request Viewer API with ?channel=jco:

curl "https://filerelay.dev/api/acme/production/requests?channel=jco&per_page=20" \
  -H "Authorization: Bearer fr_live_abc123def456"

This gives you the same response/trace context as the dashboard's Request Viewer.

Safety Notes

  • Custom BAPIs run with the connector's SAP authorisations. Treat custom like an admin-level operation: anyone with an Admin API key can read anything the service user can read.
  • Calls are rate-limited at 30 per minute per workspace in addition to the workspace's plan-level API limits. Bursts above 30/minute receive 429.
  • Sensitive parameter values (anything matching *PASS*, *SECRET*, *TOKEN* keys) are redacted in the persisted captured_requests body before storage. They are still sent to SAP at call time.

Next Steps