> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aptlydone.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Development

> Preview changes locally and understand how to use Aptly's API for integration and testing.

## Using the Aptly API

Aptly provides a secure and scalable REST API for interacting with your organization's delegation of authority and signatory management data.

This guide covers:

* API environments
* Authentication
* Request structure
* Common errors and responses
* Helpful tools

***

## 🌐 Environments

Aptly supports both US and EU regions, each with staging and production environments. Choose the environment that aligns with your organization's data residency and compliance requirements.

### **Environment Base URLs**

| Region | Environment | App Base URL                           | API Base URL Prefix                |
| ------ | ----------- | -------------------------------------- | ---------------------------------- |
| US     | Production  | `https://app.us.aptlydone.com`         | `https://api.us.aptlydone.com`     |
| US     | Staging     | `https://staging.app.us.aptlydone.com` | `https://dev.api.us.aptlydone.com` |
| EU     | Production  | `https://app.eu.aptlydone.com`         | `https://api.eu.aptlydone.com`     |
| EU     | Staging     | `https://staging.app.eu.aptlydone.com` | `https://dev.api.eu.aptlydone.com` |

Each service (e.g., auth, decision, settings) is available under its own sub-path.

**Example:**

```
https://dev.api.us.aptlydone.com/decision/v1/decisions
```

***

## 🔐 Authentication

Aptly uses token-based authentication. Tokens are scoped to your account and environment.

### To authenticate:

1. Use the Auth service to generate a token.
2. Pass the token as a bearer token in the `Authorization` header:

```http theme={null}
Authorization: Bearer YOUR_TOKEN_HERE
```

> Tokens expire after a set period. Rotate them regularly or implement refresh logic.

***

## 🧪 Testing Your Requests

You can use tools like:

* [Postman](https://www.postman.com/)
* [cURL](https://curl.se/)
* [Insomnia](https://insomnia.rest/)
* Or custom scripts using `fetch`, `axios`, etc.

### Example `curl` request:

```bash theme={null}
curl -X POST https://dev.api.us.aptlydone.com/decision/v1/decisions \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
        "name": "Approve Marketing Spend",
        "category": "Marketing",
        "requiresApproval": true
      }'
```

***

## 🚨 Error Handling

Aptly APIs return standard HTTP status codes and structured error messages.

| Code | Meaning               |
| ---- | --------------------- |
| 200  | Success               |
| 201  | Created               |
| 400  | Bad request           |
| 401  | Unauthorized          |
| 403  | Forbidden             |
| 404  | Not found             |
| 500  | Internal server error |

### Example error response:

```json theme={null}
{
  "error": "Invalid delegation",
  "details": "Missing required field: decisionId"
}
```

***

## 🧾 Versioning

Aptly APIs are versioned using the URL path.

**Example:**

```
/decision/v1/delegations
```

> Major breaking changes will increment the version (e.g., `v2`). Minor changes may be backward-compatible and reflected in the schema or changelog.

***

## 📘 Related Pages

* [Quickstart →](/quickstart)
* [System Settings Overview →](/essentials/system-settings)
* [Roles & Permissions →](/essentials/roles-permissions)
* [Delegation Lifecycle →](/essentials/delegation-lifecycle)
* [Decision API Reference →](/api-reference/decisions)

***

<Info>
  Have questions or want to request an endpoint?\
  Reach out to [support@aptlydone.com](mailto:support@aptlydone.com)
</Info>
