Skip to main content
Authentication

Add your Promptitude API key to every request for authentication.

Promptitude Team avatar
Written by Promptitude Team
Updated over 10 months ago

Promptitude uses API keys to allow access to the API.

You need to include the API Key in all API requests to the Promptitude server.

Start With Your Default Promptitude API Key

You can find your default API key in Promptitude's Settings.

Just click the little "copy" icon, and paste it into your code.

Add More API Keys When Necessary

If you're integrating Promptitude into more than one app or project, it makes sense to create a separate API Key for each of them.

In Promptitude's Settings, simply click the New API Key button in the corresponding section. In the slide-over:

  • Name your new API Key, for example like your app or project.

  • Click the Save button to generate the new API Key and save.

The list now shows your newly created API Key, ready for copy and paste.

Recommended: Header with Bearer Token

With every request you send to the Promptitude API, include an Authorization Header like this:

Header

Authorization

Value

Bearer YOUR_API_TOKEN

Deprecated: API Key in JSON Body

The API key can also be added as a parameter to the JSON body of each request.

Here's a quick example how to do it with the /generate endpoint:

const body = { 
"apiKey": "349ifpasdgasdjf73824uhaasdfh283723rhalsasdfflskdfh",
"prompt": {
"promptId": "eFAoQyBaLDD4RG4n4kMe",
"inputs": { "profession": "developers" }
}
}
fetch('https://api.promptitude.io/v1/generate', { method: "POST", body: JSON.stringify(body), headers: { 'Content-Type': 'application/json' }})

Did this answer your question?