Skip to navigation

Quickstart

Make your first request in under a minute.
View as Markdown

1. Create an API key

Keys live in a project on aegi.run, and a project belongs to you or your Discord server. Create a project, then create a key inside it.

A key is shown in full exactly once and starts with aegis.:

aegis.3f9a1c8e5b7d2049af31c6e8d5b90742a3f1c6e8d5b90742a3f1c6e8d5b90742

Keep it somewhere safe — Aegis only stores a hash of it, so a lost key cannot be recovered and has to be replaced.

2. Make a request

Every request goes to https://api.aegi.run and carries the key as a bearer token. The one exception is GET /v1/status, which needs no key at all.

curl "https://api.aegi.run/v1/translation/translate?text=hello&to=es" \
--header "Authorization: Bearer $AEGIS_API_KEY"
{
"success": true,
"data": {
"originalText": "hello",
"translatedText": "hola",
"sourceLanguage": "en",
"targetLanguage": "es"
},
"requestId": "8f14e45f-ea5c-4b1d-9c3a-2b7e6d1a0c94"
}

3. Try it from code

The JavaScript SDK wraps every endpoint with types generated from this API, so the response above comes back already unwrapped:

import { Aegis } from 'aegis-api'
const aegis = new Aegis({ apiKey: process.env.AEGIS_API_KEY })
const { translatedText } = await aegis.translation.translate({
text: 'hello',
to: 'es',
})
console.log(translatedText) // hola

4. Do something longer-running

Images and screenshots do not answer on the spot. They queue a job and return an id:

const shot = await aegis.tools.screenshot({ url: 'https://aegi.run' })
const { result } = await aegis.jobs.wait(shot.jobId, { timeout: 60 })

The jobs guide covers polling, long-polling, and how long results live.

Where to go next

  • Authentication — key formats, scopes, and the one public endpoint
  • Rate limits — what your plan allows and which headers report it
  • Errors — the error envelope, and the full list of error codes
  • Music — the largest part of the API, and the one with a different shape