API Authentication
Learn how to authenticate your requests to the GeneratedBy API.
In this section, we will guide you on how to authenticate your requests to the GeneratedBy API. This can be done by providing your API key in the Authorization header of your request.
API Keys
Generating an API Key
Before you can authenticate your requests, you need to generate an API key. Here's how you can do it:
- Log in to your GeneratedBy account.
- Navigate to the Applications section.
- Select the application for which you want to generate the API key.
- Go to the API Keys section and click on the "Generate API Key" button.
- A new API key will be generated and displayed to you.
cURL Example
Here is an example of how to use cURL to authenticate a request:
Copy code
curl --request GET \
--url https://generatedby.com/api/ENDPOINT \
--header 'Authorization: Bearer API_KEY'
Replace ENDPOINT & API_KEY with your API key.
JavaScript Example
Here is an example of how to use fetch with JavaScript to authenticate a request:
Copy code
const url = "https://generatedby.com/api/ENDPOINT"
async function fetchData() {
try {
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Bearer API_KEY",
},
})
if (!response.ok) {
throw new Error(`HTTP error ${response.status}`)
}
const jsonData = await response.json()
console.log(jsonData)
} catch (error) {
console.error("Error:", error)
}
}
fetchData()
Replace ENDPOINT & API_KEY with your API key.
For more details on how to use the API, please refer to the API section of the documentation.