API endpoints
We also recognize that not all companies provide standardized APIs, so we built an in-house widget to let you describe to your team or customers what your API looks like.
Additionally, it's super useful when working together with external teams, where you need to communicate an API specification, and instead of providing a JSON file, you provide a document with this widget, and let it describe anything from URL, Parameters, Cookies, Request structure, Response structure, etc.
You can add one by typing (api) in the editor or clicking the API icon in a new row.
fetch("https://api.cakes.com/v1/cakes/:id", {
"method": "POST",
"headers": {
"Accept": "application/json"
}
})
.then(response => {
console.log(response);
})
.catch(err => {
console.error(err);
});{
"tab": "examples",
"url": "https://api.cakes.com/v1/cakes/:id",
"name": "Cakes API",
"method": "POST",
"request": {
"pathParameters": [
{
"kind": "required",
"name": "id",
"type": "string",
"description": "ID of the cake to get, \n for free of course."
}
],
"queryParameters": [
{
"kind": "required",
"name": "recipe",
"type": "string",
"description": "The API will do its best to find \n a cake matching the provided recipe."
},
{
"kind": "required",
"name": "gluten",
"type": "boolean",
"description": "Whether the cake should be \n gluten-free or not."
}
],
"headerParameters": [
{
"kind": "required",
"name": "X-Auth-Token",
"type": "string",
"description": "Authentication token to track \n down who is emptying our stocks."
}
],
"formDataParameters": []
},
"results": {
"languages": [
{
"id": "mNZW47TKMdx5VBY_A7w-y",
"code": "{\n \"name\": \"Cake's name\",\n \"recipe\": \"Cake's recipe name\",\n \"cake\": \"Binary cake\"\n}",
"language": "200"
},
{
"id": "4txTa0_LO1TWO7FOVvFjj",
"code": "{\n \"message\": \"Ain't no cake like that.\"\n}",
"language": "404"
}
],
"selectedLanguageId": "mNZW47TKMdx5VBY_A7w-y"
},
"examples": {
"languages": [
{
"id": "5x2tfkoh7utDmGpv45DOA",
"code": "fetch(\"https://api.cakes.com/v1/cakes/:id\", {\n \"method\": \"POST\",\n \"headers\": {\n \"Accept\": \"application/json\"\n }\n})\n.then(response => {\n console.log(response);\n})\n.catch(err => {\n console.error(err);\n});",
"language": "javascript"
},
{
"id": "sDqk0BbLTuvGBkZUjLsSv",
"code": "const fetch = require('node-fetch');\n\nlet url = 'https://api.cakes.com/v1/cakes/:id';\nlet options = {\n method: 'POST', \nheaders: {\n Accept: 'application/json',\n }\n};\nfetch(url, options)\n .then(res => res.json())\n .then(json => console.log(json))\n .catch(err => console.error('error:' + err));",
"language": "nodejs"
},
{
"id": "G4ZGYdLoiDVDuj2yhZVt6",
"code": "curl --request POST\n --url https://api.cakes.com/v1/cakes/:id \n --header 'Accept: application/json'",
"language": "curl"
},
{
"id": "s6TUVImaWbitxzfW9NgLm",
"code": "import requests\n\nurl = \"https://api.cakes.com/v1/cakes/:id\"\nheaders = {\"Accept\": \"application/json\"}\nresponse = requests.request(\"GET\", url, headers=headers)\nprint(response.text)",
"language": "python"
},
{
"id": "AWzqoYUXp7zqI-QoObWAZ",
"code": "const fetch = require('node-fetch');\n\nlet url = 'https://api.cakes.com/v1/cakes/:id';\nlet options = {method: 'POST', headers: {Accept: 'application/json'}};\nfetch(url, options)\n .then(res => res.json())\n .then(json => console.log(json))\n .catch(err => console.error('error:' + err));",
"language": "ruby"
}
],
"selectedLanguageId": "5x2tfkoh7utDmGpv45DOA"
},
"responses": [
{
"statusCode": 200,
"description": "Cake successfully retrieved.",
"jsonExample": "{\n \"name\": \"Cake's name\",\n \"recipe\": \"Cake's recipe name\",\n \"cake\": \"Binary cake\"\n}"
},
{
"statusCode": 404,
"description": "Could not find a cake matching this query.",
"jsonExample": "{\n \"message\": \"Ain't no cake like that.\"\n}"
}
],
"description": "This endpoint allows you to obtain free cakes.",
"currentNewParameter": {
"label": "Path Parameter",
"value": "pathParameters"
}
}fetch("https://api.cakes.com", {
"method": "GET",
"headers": {
"Accept": "application/json"
}
})
.then(response => {
console.log(response);
})
.catch(err => {
console.error(err);
});{
"tab": "examples",
"url": "https://api.cakes.com",
"name": "Add Cake",
"method": "PUT",
"request": {
"pathParameters": [],
"queryParameters": [],
"headerParameters": [],
"bodyDataParameters": [
{
"kind": "required",
"name": "id",
"type": "string",
"description": "ID of the cake to get"
}
],
"formDataParameters": []
},
"results": {
"languages": [
{
"id": "ujXlls271GisHxHhB4Vuq",
"code": "",
"language": "100"
},
{
"id": "yJFwqLNqQZ1CqWmbDWVSV",
"code": "{\n \"name\": \"Cake's name\",\n}",
"language": "200"
},
{
"id": "veFsTjk4UScAb9yR7AK6Y",
"code": "{\n \"message\": \"Ain't no cake like that.\"\n}",
"language": "404"
}
],
"selectedLanguageId": "ujXlls271GisHxHhB4Vuq"
},
"examples": {
"languages": [
{
"id": "a7SyxH465CLSN6X0xbe4g",
"code": "fetch(\"https://api.cakes.com\", {\n \"method\": \"GET\",\n \"headers\": {\n \"Accept\": \"application/json\"\n }\n})\n.then(response => {\n console.log(response);\n})\n.catch(err => {\n console.error(err);\n});",
"language": "javascript"
},
{
"id": "48WTucfgCh18gcuyiTY-h",
"code": "A simple text.",
"language": "none"
}
],
"selectedLanguageId": "a7SyxH465CLSN6X0xbe4g"
},
"description": "Add a new cake",
"currentNewParameter": {
"label": "Body Parameter",
"value": "bodyDataParameters"
}
}It's VERY flexible letting your team describe in detail any type of HTTP endpoint.
We're also working on making it interactive, so your customers can actually make the request from here.
Find other blocks
Discover new ways and blocks to create stunning and functional documentation pages.
&#xNAN; Need help? ⬇️
Use the blue chat bubble from bottom right corner.
Or try AI Chat (from search box) for quick answers.
&#xNAN; Your opinion matters
Use the below feedback form, anonymously.
Or ask a question in Q&A section and our team or AI will give you a solution.