> For the complete documentation index, see [llms.txt](https://docs.imperialcad.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.imperialcad.app/api-and-integrations/api-integrations/getting-started.md).

# Getting Started

The ImperialCAD API is designed to give communities fast, reliable access to core features while preventing misuse and protecting system performance.

**ALL** requests follow this standard format:

<mark style="color:green;">`POST`</mark> `https://imperialcad.app/api/1.1/wf/<API_WORKFLOW_NAME>`

***

### Setup & Convars

ImperialCAD scripts rely on two required convars for identifying your community and authenticating workflow requests. These must be configured before any endpoint will function properly.

#### Server.cfg Configuration

Add the following to your `server.cfg` **above** the ImperialCAD resource:

```lua
setr imperial_community_id "YOUR_COMMUNITY_ID"
set imperialAPI "YOUR_API_SECRET"
```

* You can find these values in `Admin > Settings > API`

***

#### Accessing Convars

```lua
local communityId = GetConvar("imperial_community_id", "")
local apiKey = GetConvar("imperialAPI", "") -- server-side only

print("ImperialCAD Community ID:", communityId)
print("ImperialCAD API Key:", apiKey ~= "")
```

* `imperial_community_id` can be accessed on both server and client.
* `imperialAPI` should remain server-side only for security purposes.

***

#### API Authorization

All  <mark style="color:green;">`POST`</mark>  endpoints require the following header:

```lua
{
  "Content-Type": "application/json",
  "APIKEY": GetConvar("imperialAPI", "")
}
```

***

### Rate Limits

#### 200 OK - Rate Limiting Responses

```lua
{
  "status": "RATE_LIMIT",
  "message": "You're sending request too frequently, please slow down."
}
```

**Reasoning:** A workflow executed for the same user within the last minute. Duplicate triggers are suppressed to prevent unnecessary calls.

```lua
{
  "status": "RATE_LIMIT",
  "message": "Threshold Reached"
}
```

**Reasoning:** The request is valid, but the workflow is at maximum active concurrency. This limit protects server stability and may adjust as usage scales.

***

#### 400 Bad Request - Workflow Not Executed

```lua
{
  "status": "NOT_RUN",
  "message": "The condition for the workflow is not met. Workflow won't run."
}
```

**Reasoning:** Required conditions for the workflow were not met. Typical causes include:

* Missing or invalid community ID
* Missing or invalid API key
* Invalid Discord user ID\
  (user must exist and be apart of the community)
* Data mismatch preventing workflow validation
* Advanced API is turned off (some endpoints only).

***

### Licensing

© Imperial Software Solutions, LLC. \
All rights reserved. Unauthorized use, reproduction, or distribution is strictly prohibited.
