Tana Projects

icon picker
Google Apps Script -> Tana

Creating Tana Nodes with the Undocumented Tana API
Tana presently offers no public API or webhooks. That will change, but until then, there is a rudimentary API that is both undocumented, but possibly useful for now. If you care only about creating nodes from a script (such as Google Apps Script), this might help.
Apparently there is only a single method supported (addToNode) which is expressed in the endpoint URL:
https://europe-west1-tagr-prod.cloudfunctions.net/
Likewise, there is apparently a single parameter for this method; note. The note parameter may only include plain text, so it rules out any possibility of Markdown to shape these new nodes as they are created. I tested many note variants without success.

Tana API Token

Tokens are made available relative to each node in your workspace. Position your cursor on the node where you want to generate new nodes and use Cmd/Ctrl-K to get the token for the target node.
CleanShot 2023-02-14 at 10.21.19@2x.png
Using the command, Get API Token, it will return a token that looks like this and it’s automatically copied into your copy buffer.
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJub2RlSWQiOiJ5cXFRUXV6TEVOIiwiZmlsZUlkIjoiNUcxelhEUHJ0WiIsInRpbWUiOjE2NzYzMzE0ODI4NDF9.JXHKHsM-H4n1MFOtU-Ebv2dkBxXAfh2qNIFifpbw-xx

Google Apps Script

I used Google Apps Script to validate how this API works. The following script is about the simplest example you could create.
// statics
var cTanaEndpoint = "https://europe-west1-tagr-prod.cloudfunctions.net/";
var cTanaToken = "<your token goes here>";

//
// test tana add to node
//
function testTanaAddToNode()
{
var nodeContent = "Test 7...";
Logger.log(tanaAddToNode_(nodeContent));
return(true);
}
function tanaAddToNode_(nodeContent)
{
var url = cTanaEndpoint + "addToNode?note=" + encodeURIComponent(nodeContent);
const options = {
method: 'GET',
headers: {
'Authorization' : 'Bearer ' + cTanaToken,
'Content-Type' : 'application/json;charset=utf-8'
}
};
response = UrlFetchApp.fetch(url, options);
return(response);
}

Running this script (testTanaAddToNode), we see this new node added in my own workspace:
CleanShot 2023-02-14 at 10.28.31@2x.png
©
2024
Global Technologies Corporation. All rights reserved.
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.