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

# API Reference

> Complete API documentation for genui.sh

## Base URL

All API requests should be made to:

```
https://genui.sh/api
```

## Authentication

All endpoints require authentication via Bearer token. Include your API key in the `Authorization` header:

```
Authorization: Bearer YOUR_API_KEY
```

See [Authentication](/authentication) for details on obtaining and using API keys.

## Request Format

All POST and PUT requests should include:

```
Content-Type: application/json
```

Request bodies should be valid JSON.

## Response Format

All responses are JSON with the following structure:

**Success Response:**

```json theme={null}
{
  "id": "art_abc123",
  "template": "markdown",
  "status": "active",
  ...
}
```

**Error Response:**

```json theme={null}
{
  "error": {
    "code": "error_code",
    "message": "Human-readable error message"
  }
}
```

## HTTP Status Codes

| Code | Description                               |
| ---- | ----------------------------------------- |
| 200  | Success                                   |
| 201  | Created                                   |
| 400  | Bad Request - Invalid parameters          |
| 401  | Unauthorized - Invalid or missing API key |
| 403  | Forbidden - Insufficient permissions      |
| 404  | Not Found - Resource doesn't exist        |
| 429  | Too Many Requests - Rate limited          |
| 500  | Internal Server Error                     |

## Rate Limiting

Requests are rate limited based on your plan. Rate limit headers are included in all responses:

```
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 59
X-RateLimit-Reset: 1705320000
```

## Pagination

List endpoints support pagination with these query parameters:

| Parameter | Type    | Description                            |
| --------- | ------- | -------------------------------------- |
| `limit`   | integer | Items per page (default: 20, max: 100) |
| `offset`  | integer | Number of items to skip                |
| `cursor`  | string  | Cursor for cursor-based pagination     |

## Endpoints Overview

<CardGroup cols={2}>
  <Card title="Create and Share" icon="bolt" href="/api-reference/artifacts/create-and-share">
    POST /api/artifacts/share
  </Card>

  <Card title="Create Artifact" icon="plus" href="/api-reference/artifacts/create">
    POST /api/artifacts
  </Card>

  <Card title="List Artifacts" icon="list" href="/api-reference/artifacts/list">
    GET /api/artifacts
  </Card>

  <Card title="Get Artifact" icon="eye" href="/api-reference/artifacts/get">
    GET /api/artifacts/\[id]
  </Card>

  <Card title="Update Artifact" icon="pen" href="/api-reference/artifacts/update">
    PUT /api/artifacts/\[id]
  </Card>

  <Card title="Delete Artifact" icon="trash" href="/api-reference/artifacts/delete">
    DELETE /api/artifacts/\[id]
  </Card>

  <Card title="Share Artifact" icon="share" href="/api-reference/artifacts/share">
    POST /api/artifacts/\[id]/share
  </Card>
</CardGroup>
