Skip to end of metadata
Go to start of metadata

Folio ERM Agreement API

A draft Open API Specification (OAS) v3 is available at

This file can be downloaded and used to generate API Collections in Postman (join the #learning-apis channel on the Folio Slack for more information). The OAS definition can also be pasted directly into the Swagger API editor to get an interactive version of the API

If using Postman, it is recommended to setup Postman environments with the following variables:

  • okapiPort (port number, if there is one, for Okapi)
  • okapiProtocol (http or https)
  • okapiUrl (url for the okapi server omitting protocol and port)
  • username (valid Folio user)
  • password (p/w for the Folio user)
  • x-okapi-tenant-value (to be used as the value for x-okapi-tenant for all requests)
  • x-okapi-token-value  (to be used as the value for x-okapi-token for all requests. Using the script below if the x-okapi-token is not set, it will be set automatically)
  • baseUrl (the url for Okapi, using the script below this will be built automatically from the okapiProtocol, okapiUrl and okapiPort)

For the Collection you have generated from the OAS definition, add the following as a Pre-request script. This will ensure that:

  • the baseUrl is built
  • the x-okapi-token-value is set. Note that you can set the baseUrl and x-okapi-token manually if you prefer by editing in the Environment variables directly
  • that the x-okapi-token-value and x-okapi-tenant-value are used to populate the x-okapi-token and x-okapi-tentant in all request headers
const xOkapiTenantValue = pm.environment.get("x-okapi-tenant-value");
const okapiPort = pm.environment.get("okapiPort");
const okapiProtocol = pm.environment.get("okapiProtocol");
const okapiUrl = pm.environment.get("okapiUrl");
const username = pm.environment.get("username");
const password = pm.environment.get("password");
const baseUrl = `${okapiProtocol}://${okapiUrl}${okapiPort?':'+okapiPort:''}`

pm.environment.set("baseUrl", baseUrl)
const loginRequest= {
url: `${baseUrl}/authn/login`,
method: 'POST',
header: [
"Content-type: application/json",
body: {
mode: 'raw',
raw: JSON.stringify({ "username": username,"password":password })

if (!pm.environment.get("x-okapi-token-value")) {
pm.sendRequest(loginRequest, function (err, res) {
pm.test('response should be okay to process', function () {
pm.expect(res)'code', 200);
pm.expect(res)'status', 'OK');"x-okapi-token");
var token=res.headers.get("x-okapi-token")
pm.environment.set("x-okapi-token-value", token);

// example containing a test ** under the Tests tab only
pm.sendRequest('', function (err, res) {
if (err) { console.log(err); }

// Set okapi headers for authorisation to work
pm.request.headers.upsert({key: 'x-okapi-tenant', value: pm.environment.get('x-okapi-tenant-value') })
pm.request.headers.upsert({key: 'x-okapi-token', value: pm.environment.get('x-okapi-token-value') })

Folio ERM License RAML

RAML files for mod-licenses available at

  • No labels