FileRelay
Documentation
Try our Sandbox

Data API (SAP OData)

Read SAP business records and their files through FileRelay's REST API: list, read by key, download content and describe fields for the OData entity sets you enable. No SAP credentials in your app.

Data API (SAP OData)

The Data API lets your applications read SAP business records and their files through FileRelay, for the OData entity sets you choose. Your code calls FileRelay with an API key; FileRelay calls SAP with the repository's own credentials. Your application never holds SAP credentials, and SAP needs no custom development.

You get Endpoint
Records (rows) GET /api/{workspaceSlug}/repositories/{id}/odata/{entitySet}
One record by key GET .../odata/{entitySet}/entity?keys[Key]=value
The record's file (PDF, image…) GET .../odata/{entitySet}/content?keys[Key]=value
The fields you may read GET .../odata/{entitySet}/describe

{id} is the repository's ID (shown in its details), and {entitySet} is an entity set enabled on that repository.

Turn it on

  1. Open Repositories and click the OData repository.
  2. Under Data API, add an entity set:
    • SAP entity set: the name in SAP's service, for example A_AttachmentContentSet.
    • Key: the property (or properties) SAP uses to find one record, and its type.
    • Fields the API returns: an API name for each SAP property you expose. Nothing else leaves SAP.
    • File content: whether the record is a file ($value), a property holds the file, or there is no file.
  3. Click Test against SAP. FileRelay reads up to three rows with your mapping and shows them, before anything is saved.
  4. Save the entity set, then switch the Data API on.

The repository's details then list the ready-to-copy endpoints for each entity set. Switching the Data API off stops all reads at once and keeps your mapping.

Self-hosted operators can also set the access route in ODATA_ACCESS_ROUTES_JSON (for example to read through the connector, or to switch a repository off). An operator route always wins over the switch in the app.

Authentication and permissions

Send an API key as a Bearer token (Authentication):

Authorization: Bearer fr_live_abc123…

The caller needs the owner, admin or member role in the workspace. A token restricted with scopes needs scope:odata:read. Viewers cannot read live SAP data.

List records

curl "https://filerelay.dev/api/acme/repositories/01J…/odata/Invoices?\$top=20&\$orderby=posted_on%20desc" \
  -H "Authorization: Bearer $FILERELAY_KEY"
Parameter Meaning
$top Rows per page, 1 to 100 (default 50)
$skip Rows to skip, for paging
$filter Up to 500 characters: comparisons on your API field names (eq, ne, gt, ge, lt, le) against a quoted text or a number, joined with and / or. contains(doc_id, '…') works when you map a field named doc_id
$orderby One API field name, optionally asc or desc

Any other parameter is rejected with 422, before SAP is called.

{
  "data": {
    "source": "live_sap",
    "repository": "OD1",
    "entity_set": "Invoices",
    "top": 20,
    "skip": 0,
    "has_more": true,
    "next_skip": 20,
    "items": [
      {
        "fields": { "invoice": "5100000042", "vendor": "ACME", "amount": "1250.00", "posted_on": "2026-11-03" },
        "keys": { "InvoiceNo": "5100000042" },
        "content_available": true
      }
    ]
  }
}

Use has_more and next_skip to page. SAP's own paging links are never followed or returned, and offset paging is not a stable snapshot if SAP data changes between pages.

Read one record

curl "https://filerelay.dev/api/acme/repositories/01J…/odata/Invoices/entity?keys[InvoiceNo]=5100000042" \
  -H "Authorization: Bearer $FILERELAY_KEY"

Every configured key must be given exactly; composite keys use one keys[...] per part.

Download the file

curl -o invoice.pdf "https://filerelay.dev/api/acme/repositories/01J…/odata/Invoices/content?keys[InvoiceNo]=5100000042" \
  -H "Authorization: Bearer $FILERELAY_KEY"

The response is the file's bytes, with SAP's content type, Content-Disposition: attachment and X-Content-Type-Options: nosniff. Only entity sets with File content set offer this; describe lists content among their operations.

Describe the fields

curl "https://filerelay.dev/api/acme/repositories/01J…/odata/Invoices/describe" \
  -H "Authorization: Bearer $FILERELAY_KEY"
{ "data": { "entity_set": "Invoices", "fields": ["invoice", "vendor", "amount", "posted_on"],
  "keys": { "InvoiceNo": "string" }, "operations": ["list", "entity", "content"], "odata_version": "v2" } }

This answers from your mapping and never calls SAP.

Example: an invoice row and its PDF

A typical integration lists new invoices, then fetches each one's PDF:

import os, requests

BASE = "https://filerelay.dev/api/acme/repositories/01J…/odata/Invoices"
H = {"Authorization": f"Bearer {os.environ['FILERELAY_KEY']}"}

page = requests.get(BASE, headers=H, params={"$filter": "posted_on ge '2026-11-01'", "$top": 50}).json()["data"]
for item in page["items"]:
    key = item["keys"]["InvoiceNo"]
    print(key, item["fields"]["vendor"], item["fields"]["amount"])
    if item["content_available"]:
        pdf = requests.get(f"{BASE}/content", headers=H, params={"keys[InvoiceNo]": key})
        pdf.raise_for_status()
        open(f"{key}.pdf", "wb").write(pdf.content)

To be told about new documents instead of polling, add an HTTP destination with Data only: FileRelay posts each document's details and SAP metadata to your endpoint, with links to fetch the file.

Errors

Status Meaning
401 Missing or invalid API key
403 Your role, or the token's scopes, do not allow live SAP reads
404 The repository is not an active OData repository, the Data API is off, or the entity set is not enabled
422 Unsupported parameter, invalid filter, or keys that do not match the configured key
429 SAP is throttling; wait for Retry-After seconds
502 / 503 / 504 SAP failed, the repository's connection is misconfigured, or SAP timed out

SAP's own error text is never passed through. Every read is recorded in the audit log (odata.read) without the data itself.

Limits

  • Read-only. Writes are not supported.
  • Only the entity sets and fields you map are reachable; there is no access to arbitrary SAP tables or metadata.
  • No navigation between related entities ($expand) and no field selection beyond your mapping.
  • Up to 100 rows per page; files are size-capped by the deployment.

Next steps