Use the AutogenAI public API to upload documents to your document library from your own systems. This guide is for developers and IT teams.
With the public API, you can:
- Automate uploads from your internal systems
- Control exactly what content enters your library
- Integrate AutogenAI with your existing infrastructure and automation pipelines
Not sure the API is the right method for your team? Contact your customer success manager or email support@autogenai.com.
On this page:
- Before you start
- Step 1: Generate your API key and secret
- Step 2: Add the required headers
- Step 3: Generate the signature
- Step 4: Send your API request
- API endpoint reference
- Typical upload flow
- Example use cases
- Tips for successful requests
- Troubleshooting 401 errors
- Need help?
Before you start
Ask support to turn on API access
API access is enabled per organization. Email support@autogenai.com (or contact your customer success contact) with:
- Your organization's name
- The address you sign in at (for example, app.autogenai.com)
- The email of the person who will create the API key
We'll let you know when it's on. Integrations will then appear when you click Profile in the left-hand menu.
Step 1: Generate your API key and secret
- Log in to AutogenAI.
- Click Profile in the left-hand menu and choose Integrations.
- Click + API Key.
- Name your key (for example, "Internal Sync").
- Click Confirm.
- Copy your API Key and Secret immediately and store both securely.
- Click Dismiss to close the window.
Important: The Secret is only shown once and can't be recovered. If you lose it, create a new key.
The Integrations page under Settings is for connectors and doesn't have API keys. Use the one under Profile.
What your key can access
- Your key acts as you. It only reaches libraries you can access.
- Uploading to your organization's library requires the Document Manager role.
- Libraries synced from SharePoint can't be uploaded to through the API.
- If your account is deactivated, the key stops working. For long-running integrations, create the key from a shared account.
Step 2: Add the required headers
Every API request must include these four headers:
| Header | Purpose |
|---|---|
x-access-key |
Your API key |
x-access-sign |
Signature generated from your request details and secret |
x-access-timestamp |
Current time in milliseconds |
x-access-nonce |
A unique random ID for this request (never reused) |
Step 3: Generate the signature
Build one string from the values below, then create an HMAC-SHA256 hash of it using your API secret. The result is the value of the x-access-sign header.
| Variable | Description |
|---|---|
TIME_OF_REQUEST_IN_MS |
The exact time of the request, in milliseconds |
NONCE |
A random UUID, unique for every request |
HTTP_METHOD |
The method used, in uppercase (GET, POST, and so on) |
HTTP_PATH |
The API path in lowercase, including any query string |
REQUEST_BODY |
The request body as a JSON string ({} if there's no body) |
Signature format:
<TIME> + <NONCE> + <METHOD> + <PATH> + <BODY>
JavaScript example
This sample generates an authenticated request.
import crypto from "crypto";
// Generate a signature for signing a request to the API
// - secret: your Secret (a base64 encoded string)
// - time_of_request: current time in milliseconds since 1 Jan 1970 00:00:00 UTC
// - nonce: a unique UUID for each request
// - http_method: must be uppercase
// - http_path: API path including query string
// - payload: JSON string, or '{}' if there is no request body
function get_signature(secret, time_of_request, nonce, http_method, http_path, payload) {
// Create a SHA256 HMAC using the Secret, decoded from base64
const hmac = crypto.createHmac("sha256", Buffer.from(secret, "base64"));
// Concatenate the text to be signed
const request_text =
time_of_request + nonce + http_method + http_path.toLowerCase() + payload;
hmac.update(request_text);
// Output the signature as a base64 encoded string
return hmac.digest("base64");
}
// Retrieve the endpoint URL from the API key
export const decodeApiKey = (key) => {
const jsonPayload = Buffer.from(key, "base64").toString("utf8");
return JSON.parse(jsonPayload);
};
// Example usage
const KEY = "YOUR API KEY PROVIDED BY AUTOGENAI";
const SECRET = "YOUR SECRET PROVIDED BY AUTOGENAI";
const TIME_OF_REQUEST_IN_MS = Date.now();
const NONCE = crypto.randomUUID();
const REQUEST_BODY = {}; // empty object if no payload
const HTTP_METHOD = "GET";
const HTTP_PATH = "/v0";
const { endpoint } = decodeApiKey(KEY);
const signature = get_signature(
SECRET,
TIME_OF_REQUEST_IN_MS,
NONCE,
HTTP_METHOD,
HTTP_PATH,
JSON.stringify(REQUEST_BODY)
);
const res = await fetch(endpoint + HTTP_PATH, {
method: HTTP_METHOD,
headers: {
"Content-Type": "application/json",
"x-access-key": KEY,
"x-access-sign": signature,
"x-access-timestamp": TIME_OF_REQUEST_IN_MS.toString(),
"x-access-nonce": NONCE,
},
});
if (res.ok) {
const data = await res.json();
console.log(data);
}
Not using JavaScript?
Build the body exactly as JSON.stringify does: no spaces or line breaks, and non-ASCII characters left unescaped. Send the same string you signed. In Python:
json.dumps(body, separators=(",", ":"), ensure_ascii=False)
Step 4: Send your API request
Use your preferred HTTP client. Each request must include:
- The HTTP method (GET, POST, and so on)
- The full URL: your endpoint followed by the path, for example
<your-endpoint>/v0/library - The request body, if the endpoint needs one
- All four authentication headers
Your endpoint is encoded inside your API key. Decode the key to read it, as shown in the JavaScript example above (decodeApiKey(KEY).endpoint).
API endpoint reference
Append these paths to your endpoint. The headers every request needs are listed in Step 2: Add the required headers.
1. Check connection
GET /v0
Returns { "ok": true } when your credentials are valid. Use this to test your setup.
2. List your libraries
GET /v0/library
Returns the libraries the key's owner can access. Each library includes:
-
id(number): use this as{libraryId}in the calls below -
name(string) -
organisationId(number) -
type,source,createdAt,updatedAt
3. Request a signed upload (add or overwrite a file)
POST /v0/library/{libraryId}/file/signed-upload-request
Request body
| Field | Type | Description |
|---|---|---|
filePath |
string (required) | Full path of the file in the library, including file name and extension, for example "/contracts/2026/rfp.pdf". The folder must already exist, so create it in AutogenAI first. Use "/rfp.pdf" for the top level of the library. |
size |
number (required) | File size in bytes |
shouldAnonymize |
boolean (optional) | Defaults to false
|
externalReference |
string (optional) | Your own ID for the file, such as its ID in your source system. If a file in this library already has this reference, that file is overwritten, even if filePath has changed. Without a reference, uploading to a path that already has a file overwrites that file. |
Returns
-
presignedPost({ url, fields }): where to send the file bytes -
id(string): the file's ID. Use it asfileIdin the calls below. -
method("POST"or"PUT"): how to send the file bytes
Upload the file
Send the file bytes to presignedPost.url. This request goes straight to storage, so it doesn't need the authentication headers. The URL is valid for 1 hour.
-
If method is POST: send a
multipart/form-dataPOST.- Add every entry in
presignedPost.fieldsas a form field. - Add a field named
success_action_statuswith the value201. - Add the file last, in a field named
file.
Files can be up to 2 GB. A
201response means it worked. - Add every entry in
-
If method is PUT: send a PUT with the raw file bytes as the body. A
200response means it worked.
4. Confirm the upload completed
POST /v0/library/{libraryId}/file/upload-complete
Request body
-
status("SUCCESS"or"FAILURE", required) -
fileId(string) orexternalReference(string): one of the two is required
Send SUCCESS once the upload has worked, or FAILURE if it didn't. Processing starts after SUCCESS.
5. Delete a file
DELETE /v0/library/{libraryId}/file
Request body
-
fileId(string) orexternalReference(string): one of the two is required
Typical upload flow
-
GET /v0/libraryto find yourlibraryId. -
POST .../file/signed-upload-requestto get the upload URL. - Upload the file bytes to the returned URL.
-
POST .../file/upload-completewith status"SUCCESS".
Note: There is no endpoint to list, search or download files. Keep your own record of what you've sent, for example by storing your source ID as
externalReference.
Example use cases
- Automatically send documents from your CRM or CMS into your proposal library
- Build an internal upload tool for your content team
- Batch upload files from a shared drive or archive location
Tips for successful requests
- Use a fresh nonce for every request.
- Keep your system clock accurate. Requests timestamped more than 5 minutes ago are rejected.
- Store your API Secret securely. It can't be recovered if lost.
Troubleshooting 401 errors
The error message tells you which check failed:
- Invalid headers
- Invalid timestamp
- Duplicated nonce
- Invalid signature
Need help?
If you run into issues with authentication or a specific endpoint, contact your AutogenAI customer success manager or email support@autogenai.com.