Use API Keys
API keys allow a technical user to be authorized when connecting to an SAP Build Process Automation service instance.
Prerequisites
-
You have a service key for the target SAP Build Process Automation service instance. For more information, see Create a Service Key for the SAP Build Process Automation Instance.
-
You have the value of an API key created for the target environment and with the required scope.
-
You have released, deployed, and started a running instance of the process in SAP Build Process Automation to which you would like to connect.
Context
Collect Connection Information
-
Get the following entries from the service key for the target SAP Build Process Automation service instance that are needed to configure the authentication:
-
clientid
-
clientsecret
-
url

-
-
Optional: In case you are executing an API trigger, get the URL and the definitionID of the target trigger. Go to and select the desired environment. Switch to Triggers tab and choose of the API trigger you want to execute, and then select View.

Use an API Key from an Application Running on SAP BTP
To use an API Key in requests from an application running on SAP BTP, you have to first set an additional header property in the destination that is used for these requests:
Applications created with SAP Cloud Application Programming Model (CAP)
-
For a CAP application, create an additional property with any name, for example apiKey and your API key as a value.

-
To read the apiKey, first call the destination service, assigning its value to the headers.api-key property.
-
Then, send the API key in the request header.
Applications created with SAP Cloud SDK
For an SAP Cloud SDK application, you only need to create an additional property with name URL.headers.api-key and your API key as a value. For more information, see Use the HttpClient Accessor To Configure Requests To Remote Services.
Test an API Key - Execute an API Trigger Using an API client
Use an API client of your choice to send an HTTP POST request that executes the API trigger. The configuration options for different API clients might differ, but these are the most common settings that you have to provide.
Configure Authentication
-
Enter the trigger URL.
-
As authentication type choose OAuth 2.0. In this case you would have to connect to a URL and get the access token that will allow you to send the POST request.
-
Choose client credentials as a way to authenticate when connecting to the access token URL.
-
Enter the access token URL. Use the value from the url property, and append /oauth/token to it.
-
Enter the client ID and the client secret, providing the previously copied clientid and clientsecret.
-
Request the access token and confirm that it's issued.
Configure the API Call
-
Include your API key in the request headers by adding an api-key entry and assigning your API key as its value.
-
Define the payload in the request body using the Payload example from the API trigger definition and assign some test values for the variables.
-
Execute the request. If the request is successful, you will get "201 Created" as a response.
Result: You have successfully created a process instance via the API trigger.

