Skip to content

Hosted APIs ​

A Hosted API lets an external system call YuzeData over HTTP, on a URL of its own.

What is a Hosted API? ​

A Hosted API exposes one operation of a connector over HTTP. A Hosted API can also be an MCP server, which offers operations as tools to AI agents. The external system starts the call, to send data to YuzeData or to get data from it. What a call does depends on the operation: one operation receives webhook events, another returns data.

A Hosted API in YuzeData

A Hosted API uses the settings of its connector, such as credentials. On top of that it has settings of its own:

SettingWhat it is
NameHow the Hosted API shows in lists and when you give an API client access
OperationThe connector operation that answers the calls, with its own operation settings
Custom base URLAn optional extra, short URL for the Hosted API
Endpoint settingsPer endpoint: whether it converts JSON → XML, and a response script

A connector can have several Hosted APIs, also for the same operation. Each one has its own URLs and its own operation settings.

Hosted API or workflow?

Use a Hosted API when the external system starts the call. When YuzeData should fetch data from an external system itself, use the connector in a workflow instead.

Deploy a Hosted API ​

  1. Go to Operate → API hosting and click Deploy.
  2. If MCP servers are turned on for your organization, choose API and click Next.
  3. Find the connector, select it and click Deploy. The list only shows connectors with an operation that can be called over HTTP.
  4. Go through the three steps of the wizard, then click Finish.
StepWhat you do
ConnectorChoose Use an existing connector and pick it, or Create a new connector and fill in its name and settings. If you have no connector of this type yet, a new one is created together with the Hosted API.
OperationIn Choose the operation, pick the operation to expose and fill in its settings. The endpoints of the operation show below it, each with its JSON → XML switch and response script.
DescriptionEnter the Name, and optionally a Custom base URL.

You can also add a Hosted API to a connector you already deployed. Go to Operate → Connectors, open the connector, select the Hosted APIs tab, and click Add Hosted API. This tab only shows for connectors with an operation that can be called over HTTP.

MCP servers ​

An MCP server is a Hosted API for AI agents that speak the Model Context Protocol (MCP), such as Claude. Instead of one operation over HTTP, it offers chosen operations of the connector as tools, for example Find suppliers. Only operations that read data can be a tool; the agent fills in each tool's input and settings when it runs it. An agent gets at most 100 records per run.

Your own MCP server or an external one? ​

There are two kinds of MCP server in YuzeData. Don't mix them up: they are set up and used differently.

Your own MCP serverExternal MCP server
What it reads fromYour system, through one of your connectors, such as Get suppliers from SAPThe system of the company that runs it
Who sets it upYou, from Operate → API hostingYuzeData, for your organization
Where you find itOperate → API hosting, and in the AI Assistant under MCP servers → Your MCP serversLibrary → Agents, under External
AI AssistantCan use it straight away, without connecting itCan use it once an administrator connects it with the key from that company
Who can use itUsers whose role lets them start connectors, such as Integration owner or AdminEveryone in your organization, once it is connected
AI apps such as ClaudeCan connect to it, as a user or with an API clientCannot use it through YuzeData

To get an MCP server for one of your connectors, deploy one as below. You don't need to build an MCP server yourself. For external MCP servers, see Connect External Agents.

Deploy an MCP server ​

To deploy one:

  1. Go to Operate → API hosting and click Deploy.
  2. Choose MCP server and click Next.
  3. Find the connector, select it and click Deploy.
  4. Go through the three steps of the wizard, then click Finish.
StepWhat you do
ConnectorChoose an existing connector or create a new one, as for an API.
ToolsTick the operations the MCP server offers as tools. All of them are ticked to start with.
DescriptionEnter the Name. Optionally enter a Custom base URL, so the agent connects on /{custom-url} instead of /mcp/{id}. It must be unique across all Hosted APIs and works only for OAuth API clients.

The Tools tab lets you change which tools it offers. Each run shows in the Run history of the MCP server.

Who can use your MCP server ​

  • In the AI Assistant: every MCP server of your organization shows under MCP servers → Your MCP servers, already connected. The AI Assistant runs its tools as you, so you only get them when your role lets you start connectors, such as Integration owner or Admin.
  • From an AI app such as Claude: add the URL from the Overview tab to the app. You then sign in with your own YuzeData account, and the same role rule applies. The app runs the tools as you.
  • From another system: give an API client access to the MCP server, the same way as for an API. The Overview tab shows how to connect.

Find a Hosted API ​

Go to Operate → API hosting. The list shows every Hosted API with its type, who last changed it and when it last ran. Not run yet means no one has called it so far.

  • Use the tabs All, APIs and MCP servers to see one type. Each tab shows how many there are.
  • Search by name, or paste a URL of the Hosted API to find the one it belongs to.
  • Pick one or more connectors to see only their Hosted APIs.

Give an external system access ​

An external system calls a Hosted API with the credentials of an API client. An API client can only call the Hosted APIs it has been given access to.

  1. Go to Manage → Organization → API clients and click Create API client.
  2. Enter a name and choose the Authentication strategy:
Authentication strategyHow the external system signs in
OAuth 2.0 bearer tokenGets a token with the client ID and a secret, and sends the token with each call
Basic authenticationSends the client ID and a secret with each call
Webhook with signature validationSigns each call with a shared secret
  1. Open the API client and set up its credentials:
    • For OAuth 2.0 and Basic authentication, click Create new secret and choose how long it stays valid. The secret is shown only once, so copy it and store it in a safe place.
    • For webhooks, fill in the Webhook HTTP header name and the Webhook shared secret, and click Update. The external system signs the request body with HMAC-SHA256 and puts the signature in that header.
  2. In Grants access to APIs, add the Hosted API.

To see which API clients can call a Hosted API, go to Operate → API hosting and click the Hosted API. Its overview links to the API clients for each way to authenticate.

WARNING

Avoid secrets that never expire for production use. Regular rotation of credentials reduces the risk if a secret leaks.

See Users & Access for more about API clients.

Connect to a Hosted API ​

Go to Operate → API hosting and click the Hosted API. The Overview tab shows what the external system or AI agent needs, in three steps:

StepWhat it shows
1. AuthenticationThe ways to sign in that the API clients with access use: OAuth client credentials, Basic authentication or Webhook. Pick one to see the API clients that use it, and for OAuth the token endpoint.
2. URLThe URL to call for that way of signing in, with a copy button. With OAuth, a custom base URL is listed too. For a webhook, each webhook API client has its own URL. Open documentation shows the API reference of the Hosted API. For a Hosted API with a script, this is the description in its OpenAPI editor (see Documenting an API Connector Script).
3. ExampleAn example request to start from, or for an MCP server an example configuration to add to the agent. Copy it and fill in the credentials.

TIP

Only the ways to sign in that an API client with access actually uses are shown. When no API client has access yet, the overview says so and links to API clients. An MCP server has no webhook URL, so a webhook API client cannot connect to it.

See what a Hosted API exposes ​

Go to Operate → API hosting, click the Hosted API and select the Endpoints tab. It lists what the external system can call, with for each endpoint:

EntryWhat it tells you
MethodHow it is called. Green methods, such as GET, read data. Yellow methods, such as POST, send or change data.
PathWhat to add to a URL from the Overview tab to call the endpoint
Name and descriptionWhat the endpoint does

TIP

You can check the endpoints before you deploy anything. They show on the HTTP API tab of the connector in Library → Connectors, and in the Operation step when you deploy a Hosted API. A deployed connector lists them on its Hosted APIs tab.

Custom base URL ​

A custom base URL gives the Hosted API an extra, short URL, such as /suppliers, next to its standard one.

  • It may only contain letters, digits, hyphens and underscores.
  • No other Hosted API can use the same custom base URL.
  • It only works for OAuth 2.0 API clients. Basic authentication and webhook API clients use their own URL, shown on the Overview tab.
  • Clear the field to remove the custom base URL.

JSON to XML ​

On the Endpoints tab, each endpoint has a JSON → XML switch. An operation can send and receive JSON or XML; the switch doesn't change which.

  • Off (the default) passes requests and responses through unchanged. Keep it off when the operation already sends and receives XML, such as the Enhesa XML feeds: callers keep getting the XML the operation returns.
  • On is for an endpoint that works in JSON when the external system needs XML. An XML request then reaches the operation as JSON, and a JSON response goes back as XML. Other content, such as files, is not changed.
  • When the operation can't list its endpoints, one All endpoints row holds the setting for all of them.
  • Choose Update to save. You can also set it on the operation step of the wizard.

Response scripts ​

On the Endpoints tab, each endpoint of the operation can have a script that reshapes its JSON or text response before it reaches the caller. Choose Add response script next to the endpoint, write the script in the dialog, choose Apply, and then Update to save. Edit response script opens it again. When you deploy a Hosted API, you can add the scripts on the operation step of the wizard too. Use it for example to add a value looked up from master data:

javascript
response.hazard = (await yuze.lookupMasterDataItem(`master-data:Hazard:${response.name}`))?.displayName;
return response;
  • The script gets the parsed JSON response as response: an object or an array, with the field names as the operation sends them. A text response, such as pong, comes in as text.
  • A text response stays text when the script returns text, and becomes JSON when it returns an object or an array.
  • When the operation declares the response type of an endpoint, the editor knows the fields of response and suggests them as you type.
  • The caller gets what the script returns: change response and end with return response;, or return a new value. A script that returns nothing fails the call.
  • The master data functions of YuzeScript are available. The ? button in the editor opens that page, and the AI assistant next to the editor can write the script for you.
  • The Tests tab of the dialog holds tests of the script. Saving is refused while one fails; see Testing a Hosted API Response Script.
  • Each endpoint has its own script. Endpoints without one return their response unchanged.
  • A script, or the JSON → XML switch, can only be set on an endpoint listed on the Endpoints tab. Saving one for any other endpoint is refused, and the message lists the endpoints you can use. The All endpoints row exists only for an operation that can't list its endpoints.
  • With JSON → XML on the endpoint, the result of the script is converted to XML.
  • Error responses, and responses that are neither JSON nor text, such as files, are returned unchanged.
  • If the script fails, the caller gets an error (500) instead of the response. The error doesn't say why; run the tests of the script to find out.
  • The script can only read data, and is stopped after 30 seconds.

Operation dependencies ​

Some operations start background operations. For those, the Operation step and tab show Operation dependencies, where you choose the Capacity preference of each background operation:

OptionWhen to use it
Shared environmentRecommended for most operations
Dedicated environmentFor operations that take a long time to finish or use a lot of resources. Choose the Compute specification, from 0.25 core and 0.5 GB RAM up to 4 cores and 8 GB RAM.

Triggers ​

The Triggers section of a Hosted API runs a workflow when the Hosted API is called, for example when another system sends an event to a webhook. Each trigger names a workflow and the rules a call must match. After a call, every trigger that is on and whose rules match runs its workflow, the same way the workflow's schedule does. Triggers are checked after the response is sent, so they never slow down or fail the call. A Hosted API can have up to 20 triggers.

A rule reads one part of the call and compares it with one or more values:

Read fromWhat it reads
BodyA field of a JSON body, by its path, such as order.lines[0].sku. An empty path reads the whole body as text.
HeaderA request header, by its name.
Query parameterA parameter of the URL, by its name.
MethodThe HTTP method, such as POST.
Response statusThe status code of the response, such as 201.

A trigger fires when all its rules match, or when any one matches. A trigger without rules fires on every call. Triggers see failed calls too: add a Response status rule when only successful calls should run the workflow.

Turn on Fire once per event when the sender retries calls. Choose the value that identifies an event, such as an X-Event-Id header. A call whose value the trigger already fired on in the last 30 days doesn't run the workflow again.

Before you save, use Test with a sample call to write a call the way the sender would make it and see whether it fires the trigger. Nothing is saved or started.

The list shows when each trigger last fired and what happened. Select a trigger to see what it did with each matching call in the last 90 days, with links to the call and to the workflow run it started. A trigger whose workflow was deleted stays in the list as Workflow deleted: choose another workflow or delete the trigger. Deleting a Hosted API deletes its triggers too.

You can also add a trigger from the workflow it runs: see Starting a workflow from a Hosted API.

TIP

Changing a trigger changes which calls run a workflow, so it takes the right to change both connectors and workflows.

Run history ​

The Run history tab of a Hosted API lists the calls it served, with their events and logs. The run history of the connector lists them too, with the name of the Hosted API that served each call. Calls made before Hosted APIs had their own run history are only in the run history of the connector.

Audit ​

The Audit tab of a Hosted API shows who changed it, what they changed, and when. This works the same for Hosted APIs and Hosted MCP servers. Changes are grouped by day, with the newest first. Each entry says who made the change and where it came from. Expand an entry to see what changed: the name, the vanity URL, the body format, the response script of each endpoint, the operation settings, the capacity preference of each dependency, and for a Hosted MCP server the tools that were added or removed.

Secret settings show as Hidden. The audit tells you that a secret changed, never what it was.

Hosted APIs that existed before change tracking was switched on start with a Change tracking started entry. It records the Hosted API as it was at that moment. Earlier changes, and who made them, are not known.

Troubleshooting ​

The call is rejected as unauthorized (401)

  • Check that the external system sends the client ID and secret, or the token, of the right API client.
  • Check that the secret has not expired. If it has, create a new one.
  • Check that the URL matches the authentication strategy of the API client. A custom base URL only works for OAuth 2.0 API clients.
  • For webhooks, check that the shared secret matches on both sides. A webhook shared secret stops working one year after it was set; set a new one in YuzeData and in the external system.

A webhook call is rejected as a bad request (400)

  • The call has no signature in the header set in Webhook HTTP header name. Check that the header name matches on both sides.

A trigger did not run its workflow

  • Check that the trigger is on, and that its rules match the call. Use Test with a sample call with the call from the Run history tab.
  • Select the trigger to see what it did with the call. Duplicate means the trigger already fired on that event. Workflow deleted or No starting step means the workflow can't start. Expired means the call waited too long to be handled.

The call is rejected as forbidden (403)

  • The API client has no access to this Hosted API. Add the Hosted API to Grants access to APIs of the API client.