# SAP S/4HANA API Documentation: Where It Is and How to Use It

> Source: https://netray.co/erp-help/sap-s4-hana-api-documentation
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: ERP Help

## Short answer

S/4HANA API documentation lives on the SAP Business Accelerator Hub (api.sap.com), under the S/4HANA Cloud or S/4HANA on-premise package. Most APIs are OData (v2, and v4 for newer ones) plus SOAP for some integrations. In public cloud you authorize an external caller with communication arrangements; on-premise you activate the service in the Gateway and use basic, OAuth or certificate authentication.

## Kind

advanced

## System

sap

## Erp

SAP S/4HANA (on-premise and Cloud)

## Module

Integration / OData and SOAP APIs

## Query

sap s4 hana api documentation

## Alternate Queries

- sap s4hana public cloud api
- api sap s4hana public cloud
- sap s4 hana integration
- sap business accelerator hub odata api

## Applies To

SAP S/4HANA Cloud Public Edition, Private Edition and S/4HANA on-premise (service names are stable across releases, available fields vary by release).

## Steps

### How to start using an S/4HANA API

**Items:**

- Open the SAP Business Accelerator Hub (api.sap.com) and search the S/4HANA package. Open the API, read the resource overview and the data model, and download the EDMX or OpenAPI definition.
- On public cloud: in Fiori, use Communication Systems, Communication Users and Communication Arrangements apps. Create an arrangement from the communication scenario that contains the API, with the user and authentication type.
- On-premise: activate the OData service with /IWFND/MAINT_SERVICE (Add Service), check the ICF node in SICF, and give the technical user the authorization for the service and the underlying business objects.
- Fetch the service document and metadata ($metadata) to confirm the entity sets and fields available in your release.
- For read calls use $filter, $select, $top and $skip. For write calls (POST, PATCH), first make a GET with the header x-csrf-token: fetch, then use the returned token and the session cookies.
- Test with Postman or the hub's try-out feature on a sandbox or test client, never first on production.
- Add paging, retry on 429 and 503, and logging of the request and response IDs for support.

## Sections

### Main manufacturing and logistics APIs

**Body:**

Common OData services that manufacturers use: API_PRODUCT_SRV (material master), API_PURCHASEORDER_PROCESS_SRV (purchase orders), API_PURCHASEREQ_PROCESS_SRV (requisitions), API_MATERIAL_DOCUMENT_SRV (goods movements), API_MATERIAL_STOCK_SRV (stock), API_PRODUCTION_ORDER_2_SRV (production orders), API_SALES_ORDER_SRV, API_BUSINESS_PARTNER, and API_BILL_OF_MATERIAL_SRV. Exact names and versions differ by release and edition, so confirm each on the hub.

Not every business object has a public API in every edition. In public cloud only released APIs are allowed; in on-premise and private cloud you may also use classic BAPIs, IDocs and RFC, plus custom CDS views exposed as OData. Prefer released APIs for upgrade safety.

**Code:**

- GET /sap/opu/odata/sap/API_MATERIAL_STOCK_SRV/A_MatlStkInAcctMod
-     ?$filter=Plant eq '1000' and Material eq 'MAT-1'&$top=50
- Header: Accept: application/json

### Authentication and security

**Body:**

Public cloud supports basic authentication for a communication user in some scenarios, OAuth 2.0 (client credentials or SAML bearer) and certificates, depending on the arrangement. Use OAuth or certificates for production integrations and keep secrets in a vault.

On-premise, the Gateway can use basic auth, SAML or X.509. Use a technical user with a minimal role, restrict it to the service, and protect the Gateway with a reverse proxy or API management. Log calls and review authorizations, because an API user reads business data directly and bypasses the Fiori UI controls.

### Choosing OData, SOAP, IDoc or events

**Body:**

Use OData for reading and simple transactional writes from apps and AI tools. Use SOAP where a scenario is defined as an enterprise service, often for partner integrations. Use IDocs or events (SAP Event Mesh, business events) for asynchronous, high volume flows such as order status changes.

For bulk reads, OData paging gets slow. Use CDS based extraction, replication tools or a read replica rather than pulling millions of rows through a service.

## Pitfalls

- Writing against an unreleased API in public cloud; it can break on the next release.
- Skipping the CSRF token fetch for POST and PATCH and getting 403.
- Giving the integration user broad SAP_ALL style authorizations instead of a scoped role.
- Pulling large tables through OData instead of extraction; calls time out and slow the system.
- Relying on field names from an older release without reading $metadata on your system.

## Ai Angle

APIs are the clean way to give an AI assistant governed, role-aware access to S/4HANA. A Netray style setup connects an on-prem model to released OData services or a read replica, runs read-only by default, shows each query, and keeps the integration user scoped. Write-back, where used, goes through human approval.

## Faq

### Where is the SAP S/4HANA API documentation?

**Answer:** On the SAP Business Accelerator Hub at api.sap.com. Search the S/4HANA Cloud or on-premise package, open the API and read the resources, data model and try-out. Your own system's $metadata is the final authority.

### Does S/4HANA support REST?

**Answer:** S/4HANA exposes OData services, which are REST style over HTTP using JSON or XML. It also supports SOAP for some enterprise services, plus RFC, BAPI and IDoc on-premise.

### How do I authenticate to S/4HANA public cloud APIs?

**Answer:** Create a communication system, user and arrangement for the communication scenario that contains the API. Authentication can be basic, OAuth 2.0 or certificate depending on the scenario.

### Can I use BAPIs in S/4HANA Cloud?

**Answer:** In public cloud only released APIs and extension points are allowed, so direct BAPI and RFC use is not available the way it is on-premise. In on-premise and private cloud, BAPIs still work, but released APIs are safer for upgrades.

## Search terms

sap s4 hana api documentation, sap s4hana public cloud api, api sap s4hana public cloud, sap s4 hana integration, sap business accelerator hub, sap odata api, sap communication arrangement, sap api_purchaseorder_process_srv, sap iwfnd maint_service, sap csrf token odata

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
