Zettel API
Search…
⌃K

Authentication

Zettel API has 2 authentication models: JWT and API Key

JWT

In order to generate a JWT, Zettel API follows a standard SIWE (Sign In With Ethereum) process in which the app needs to first request to generate a nonce, and after than sign a message received from the server and send the signed message back to server for verification.
First, connect to a wallet provider to get a wallet address. for example using Metamask chrome extension and a web3 JavaScript library (like ethers).
Second, a GET request to generate a none using the connected wallet address:
https://api.zettel.ai/siwe/nonce?walletAddress=0x123...
Third, sign the returned nonce message using available client libraries & tools, like ethers and Metamask:
Fourth, send the signed message back to the server using a POST request to this URL:
https://api-stage.zettel.ai/auth/siwe/verify
using this data as the body:
{
deviceId,
walletAddress,
nonceMessage,
signedNonceMessage,
}
the response of this POST request is an object containing the JWT:
{
accessToken
}

API Key

Using the API Key created through the API panel of the Zettel Terminal Preferences page, all authenticated requests of the Zettel APIs can be done by providing an Authorization header started with a Key and followed by a space and the API Key.