New APIs are assigned generic names by default. You can rename them to something more descriptive, but the name must be unique. There are 3 ways in which you can rename an API:
F2
.Enter
or click outside the input field.The updated name will appear in the API details panel.
Enter
or click outside the input field.The updated name will appear in the API details panel.
The updated name will appear in the tree view.
From the API BASIC INFORMATION tab in the API details panel you can set the:
https://api.example.com/api/v1/users/:userId
, where :userId
is a variable segment.https://api.example.com/api/v1/users/1
(replace :userId
with a specific value).https://api.example.com/api/v1
(use this if v1
is the only API version you'll interact with).Make sure to click on the Save Changes button to persist your modifications.
All the values configured in the PAYLOAD tab are included in the documentation generated by the platform. However, only the Request Body is sent with the actual request. Configure the following in this tab:
For example, this request body:
{
"email": "gwocu@email.com",
"password": "password123",
"rememberMe": false
}
And corresponding response body:
{
"status": "success",
"data": {
"jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiR1dPQ1UgU3R1ZGlvIn0.LBryv6H4noi24RFH9ceegjx0bOEHg-sUP5urPYr9uhw",
"roles": {
"reader": true,
"designer": false,
"owner": false
},
"language": "es"
}
}
Would have this Parameter Descriptions input:
[
[
{
"name": "email",
"description": "The user's email.",
"required": true,
"type": "string"
},
{
"name": "password",
"description": "The user's password.",
"required": true,
"type": "string"
},
{
"name": "rememberMe",
"description": "Indicates if the user's session should persist across browser sessions.",
"required": false,
"type": "boolean"
}
],
[
{
"name": "jwt",
"description": "JSON Web Token used for authentication in subsequent requests.",
"type": "string"
},
{
"name": "roles",
"description": "User's roles, indicating which permissions they have.",
"type": "object",
"properties": [
{
"name": "owner",
"description": "Indicates if the user has the 'Owner' role",
"type": "boolean"
},
{
"name": "designer",
"description": "Indicates if the user has the 'Designer' role",
"type": "boolean"
},
{
"name": "reader",
"description": "Indicates if the user has the 'Reader' role",
"type": "boolean"
}
]
},
{
"name": "language",
"description": "The user's preferred language for the platform",
"type": "string",
"enum": ["en", "es"]
}
]
]
There are 2 ways in which you can inject values dynamically in your requests:
Use workspace actions to define global values or scripts for all APIs in a workspace. Use API actions to override these settings or apply new ones to individual APIs.
Workspace and API actions are defined using the same YAML structure. In your configuration file you must set a value for the type of authentication you'll use and you can choose to set globals or define JavaScript scripts to set the headers or the body of your request. We'll break down how to do each below.
The platform supports 3 authentication strategies out of the box: No Authentication, Basic Authentication, and Digital Signature. You can also manually implement other strategies.
If no authentication is required or if you prefer to manually implement your own authentication strategy, use:
Authentication-Type: No-Authentication
To authenticate with a username and password, use:
Authentication-Type: Basic-Authentication
Basic-Authentication:
username: <your-username>
password: <your-password>
overwrite: yes # Possible values: yes, no.
overwrite
is set to yes
and an Authorization
header is configured in the API Details panel, the value from the action configuration file will be used instead.Use JavaScript scripts to calculate and inject a digital signature in your payload.
Authentication-Type: Digital-Signature
Digital-Signature:
location: requestBody # Possible values: requestBody or Header
parameterName: <keyNameInPayload>
overwrite: yes # Possible values: yes, no.
token: <yourToken>
calculationFunction: function sortObject(payloadObj) {
return Object.keys(payloadObj).sort().reduce(function (result, key) {
result[key] = payloadObj[key];
return result;
}, {});
}
const apiTokenHashValue = crypto.MD5(token).toString();
const sortedParameters = sortObject(parameters);
let sortedKeyValuePairs = '';
for (const [key, value] of Object.entries(sortedParameters)) {
sortedKeyValuePairs += key + '=' + value + '&';
}
sortedKeyValuePairs += apiTokenHashValue;
return crypto.MD5(sortedKeyValuePairs).toString();
location
is set to requestBody
, the payload object used in the calculationFunction
will be the request body. If location
is set to Header
, the payload
object will be the headers.overwrite
is set to yes
, and a <keyNameInPayload>
is set in the chosen payload (either request body or header), the value used will the one defined in the action configuration file.You can implement other authentication strategies by configuring headers or request body settings as needed.
Enable and set globals on the headers of your requests using the following configuration:
Global-Parameters-Header:
enable: yes # Possible values: yes, no.
parameters:
<yourHeaderConstantKey>: <yourHeaderConstantValue>
<yourHeaderVariableKey>: |
{
return getSomeCalculatedValue();
}
overwrite: yes # Possible values: yes, no.
enable
is set to yes
, the defined headers will be included in the requests targeted by the action.overwrite
is set to yes
, and a <yourHeaderKey>
header is set for your API, the header value used in the request will be the one defined in the action configuration.|
) to define JavaScript functions that calculate values to inject into your headers.Here's an example of how you could implement JWT-based authentication with an action:
Authentication-Type: No-Authentication
Global-Parameters-Header:
enable: yes
parameters:
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiR1dPQ1UgU3R1ZGlvIn0.LBryv6H4noi24RFH9ceegjx0bOEHg-sUP5urPYr9uhw
overwrite: yes
To inject values into the request body, you must use enable
in combination with overwrite
or addIfMissing
.
Global-Parameters-RequestBody:
enable: yes # Possible values: yes, no.
parameters:
<yourRequestBodyConstantKey>: <yourRequestBodyValue>
<yourRequestBodyVariableKey>: |
{
return getSomeCalculatedValue();
}
overwrite: yes # Possible values: yes, no.
addIfMissing: no # Possible values: yes, no.
enable
and overwrite
to yes
will replace the values of the defined parameters if they are found in the request body.enable
and addIfMissing
to yes
will add the defined parameters if they are not found in the request body.enable
to no
will prevent any parameters from being replaced or added, regardless of the overwrite
or addIfMissing
settings.|
) to define JavaScript functions that help you calculate values to inject in your request body.Here's an example of the effect of each combination when injecting a timestamp
value in the request body of an API using an action.
If we apply this configuration:
Global-Parameters-RequestBody:
enable: yes
parameters:
timestamp: |
{
const currentDateTime = new Date();
return currentDateTime.toISOString();
}
overwrite: yes
addIfMissing: no
To an API with this request body:
{
"timestamp": "anyValue"
}
The resulting request body will be:
{
"timestamp": "2025-01-17T20:34:54.644Z"
}
If we apply this configuration:
Global-Parameters-RequestBody:
enable: yes
parameters:
timestamp: |
{
const currentDateTime = new Date();
return currentDateTime.toISOString();
}
overwrite: no
addIfMissing: yes
To an API with this request body:
{}
The resulting request body will be:
{
"timestamp": "2025-01-17T20:34:54.644Z"
}
Even if a parameter will be dynamically replaced or added, it's a good practice to explicitly declare all the parameters you expect to use in your request body. Use double curly braces to indicate dynamically injected values, like this:
{
"timestamp": "{{timestamp}}"
}
To create a Workspace Action, go to the home page, open the main menu and navigate to Actions & Webhooks > Workspace Actions.
This modal will pop up in your screen:
Since a workspace action is applied to all APIs in a workspace, you can only have one workspace action per workspace.
The YAML field contains a default template to guide you in writing your configuration file.
Once you're done, make sure your YAML configuration is valid and click the Save button to apply your changes.
To create an API Action, go to the home page, open the main menu and navigate to Actions & Webhooks > API Actions.
This modal will pop up in your screen:
Unlike Workspace Actions, API actions are scoped to individual APIs, allowing multiple actions within the same workspace.
You must assign them a unique name to identify them. You can't change an API action name, but you can always reuse their configuration to create a new one. Optionally, you can add a description to clarify its purpose.
The YAML field contains a default template to guide you in writing your configuration file. Once you're done, make sure your configuration is in valid YAML format and click the Add action button to save the action.
To view or edit the details of an API action, click its row in the table. Click again to unselect it.
To apply an API action on an API:
To call an API, use the run
command in the terminal interface of the TERMINAL tab within the API details panel.
The response will be displayed as a JSON object containing both the status and the response body. You can hover over a parameter or its value to reveal the Copy to clipboard button.
Use the clear
command to reset the terminal interface.
To import APIs into the workspace from another workspace, OpenAPI documentation, or a Postman collection:
New APIs are stored in the Unassigned APIs folder by default, however you can create folders to group and organize your APIs as your collection grows.
To create a folder:
The new folder will appear as the last item in the chosen location.
Folders are assigned generic names by default. You can rename all folders except MyFolder and Unassigned APIs, which are system folders. Folder names must be unique. There are two ways to rename a folder:
F2
.Enter
or click outside the input field to save the changes.Enter
or click outside the input field to save the changes.You can drag and drop APIs into any other folder, and drag and drop folders into other folders except for the Unassigned APIs one.
Create copies of an API while preserving all its original data except for the name. There are 2 ways to copy an API:
An alert will confirm the API has been copied to the Unassigned APIs folder, where it will appear as the last item.
An alert will confirm the API has been copied to the Unassigned APIs folder, where it will appear as the last item.
There are 2 ways to remove an API:
You can remove all non-empty folders, except for the system folders (MyFolders and Unassigned APIs), using the same methods as removing an API:
Export APIs as OpenAPI definitions or as StudioAPI files for importing into other workspaces, using their documentation, or working with them in other REST clients. To expor APIs:
Shift
to select a range of APIs or Ctrl
(or Cmd
on Mac) to select multiple APIs individually.