Create a REST API credential
curl --request POST \
--url https://api.cloudhumans.com/typebot/v1/credentials \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"credentials": {
"type": "rest-api",
"workspaceId": "<string>",
"name": "<string>",
"data": {
"baseUrl": "<string>",
"headers": [
{
"key": "<string>",
"value": "<string>"
}
],
"queryParams": [
{
"key": "<string>",
"value": "<string>"
}
]
}
}
}
'import requests
url = "https://api.cloudhumans.com/typebot/v1/credentials"
payload = { "credentials": {
"type": "rest-api",
"workspaceId": "<string>",
"name": "<string>",
"data": {
"baseUrl": "<string>",
"headers": [
{
"key": "<string>",
"value": "<string>"
}
],
"queryParams": [
{
"key": "<string>",
"value": "<string>"
}
]
}
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
credentials: {
type: 'rest-api',
workspaceId: '<string>',
name: '<string>',
data: {
baseUrl: '<string>',
headers: [{key: '<string>', value: '<string>'}],
queryParams: [{key: '<string>', value: '<string>'}]
}
}
})
};
fetch('https://api.cloudhumans.com/typebot/v1/credentials', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cloudhumans.com/typebot/v1/credentials",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'credentials' => [
'type' => 'rest-api',
'workspaceId' => '<string>',
'name' => '<string>',
'data' => [
'baseUrl' => '<string>',
'headers' => [
[
'key' => '<string>',
'value' => '<string>'
]
],
'queryParams' => [
[
'key' => '<string>',
'value' => '<string>'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.cloudhumans.com/typebot/v1/credentials"
payload := strings.NewReader("{\n \"credentials\": {\n \"type\": \"rest-api\",\n \"workspaceId\": \"<string>\",\n \"name\": \"<string>\",\n \"data\": {\n \"baseUrl\": \"<string>\",\n \"headers\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"queryParams\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.cloudhumans.com/typebot/v1/credentials")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"credentials\": {\n \"type\": \"rest-api\",\n \"workspaceId\": \"<string>\",\n \"name\": \"<string>\",\n \"data\": {\n \"baseUrl\": \"<string>\",\n \"headers\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"queryParams\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloudhumans.com/typebot/v1/credentials")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"credentials\": {\n \"type\": \"rest-api\",\n \"workspaceId\": \"<string>\",\n \"name\": \"<string>\",\n \"data\": {\n \"baseUrl\": \"<string>\",\n \"headers\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"queryParams\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"credentialsId": "<string>"
}{
"message": "<string>",
"code": "<string>",
"issues": [
{}
]
}{
"message": "<string>",
"code": "<string>",
"issues": [
{}
]
}{
"message": "<string>",
"code": "<string>",
"issues": [
{}
]
}{
"message": "<string>",
"code": "<string>",
"issues": [
{}
]
}Credentials
Create a REST API credential
Creates a REST API credential in a workspace and returns only its credentialsId. The credential stores a base URL plus optional headers and query params, encrypted, and no endpoint ever returns them.
To use it, put the returned credentialsId in the options.credentialsId of an HTTP Request block with Update a flow. The block then sends the credential’s base URL, headers and query params without any secret appearing in the flow.
- Creating needs the workspace admin role (
403otherwise). - A
namealready used by another REST API credential is a409. Check List REST API credentials first and reuse one that fits. baseUrlmust be anhttporhttpsURL with nouser:password@, query string or fragment (400otherwise). Secrets go inheadersorqueryParams, never in the URL.
POST
/
v1
/
credentials
Create a REST API credential
curl --request POST \
--url https://api.cloudhumans.com/typebot/v1/credentials \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"credentials": {
"type": "rest-api",
"workspaceId": "<string>",
"name": "<string>",
"data": {
"baseUrl": "<string>",
"headers": [
{
"key": "<string>",
"value": "<string>"
}
],
"queryParams": [
{
"key": "<string>",
"value": "<string>"
}
]
}
}
}
'import requests
url = "https://api.cloudhumans.com/typebot/v1/credentials"
payload = { "credentials": {
"type": "rest-api",
"workspaceId": "<string>",
"name": "<string>",
"data": {
"baseUrl": "<string>",
"headers": [
{
"key": "<string>",
"value": "<string>"
}
],
"queryParams": [
{
"key": "<string>",
"value": "<string>"
}
]
}
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
credentials: {
type: 'rest-api',
workspaceId: '<string>',
name: '<string>',
data: {
baseUrl: '<string>',
headers: [{key: '<string>', value: '<string>'}],
queryParams: [{key: '<string>', value: '<string>'}]
}
}
})
};
fetch('https://api.cloudhumans.com/typebot/v1/credentials', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cloudhumans.com/typebot/v1/credentials",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'credentials' => [
'type' => 'rest-api',
'workspaceId' => '<string>',
'name' => '<string>',
'data' => [
'baseUrl' => '<string>',
'headers' => [
[
'key' => '<string>',
'value' => '<string>'
]
],
'queryParams' => [
[
'key' => '<string>',
'value' => '<string>'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.cloudhumans.com/typebot/v1/credentials"
payload := strings.NewReader("{\n \"credentials\": {\n \"type\": \"rest-api\",\n \"workspaceId\": \"<string>\",\n \"name\": \"<string>\",\n \"data\": {\n \"baseUrl\": \"<string>\",\n \"headers\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"queryParams\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.cloudhumans.com/typebot/v1/credentials")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"credentials\": {\n \"type\": \"rest-api\",\n \"workspaceId\": \"<string>\",\n \"name\": \"<string>\",\n \"data\": {\n \"baseUrl\": \"<string>\",\n \"headers\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"queryParams\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloudhumans.com/typebot/v1/credentials")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"credentials\": {\n \"type\": \"rest-api\",\n \"workspaceId\": \"<string>\",\n \"name\": \"<string>\",\n \"data\": {\n \"baseUrl\": \"<string>\",\n \"headers\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"queryParams\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"credentialsId": "<string>"
}{
"message": "<string>",
"code": "<string>",
"issues": [
{}
]
}{
"message": "<string>",
"code": "<string>",
"issues": [
{}
]
}{
"message": "<string>",
"code": "<string>",
"issues": [
{}
]
}{
"message": "<string>",
"code": "<string>",
"issues": [
{}
]
}Authorizations
Body
application/json