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

# API Discovery

> Navigate the API using HATEOAS links

## Hypermedia-Driven API

The GreetIncs API implements HATEOAS (Hypermedia as the Engine of Application State). Every response includes a `links` array that tells you what actions are available and where related resources live.

### Response Structure

All responses follow this structure:

```json theme={null}
{
  "response_type": "AnalysisCreateResponse",
  "data": { ... },
  "links": [
    {
      "href": "/v1/analyses/analysis_01h45ytscbebyvny4gc8cr8ma2",
      "rel": "self",
      "method": "GET",
      "title": "Get Analysis"
    },
    {
      "href": "/v1/analyses/analysis_01h45ytscbebyvny4gc8cr8ma2/status",
      "rel": "status",
      "method": "GET",
      "title": "Check Status"
    },
    {
      "href": "/v1/analyses/analysis_01h45ytscbebyvny4gc8cr8ma2/results",
      "rel": "results",
      "method": "GET",
      "title": "Get Results"
    }
  ]
}
```

### Link Properties

| Property | Description                                                               |
| -------- | ------------------------------------------------------------------------- |
| `href`   | The URL path to the related resource                                      |
| `rel`    | The relationship type (e.g., `self`, `next`, `prev`, `status`, `results`) |
| `method` | The HTTP method to use                                                    |
| `title`  | Human-readable description of the action                                  |

### Common Relationships

| Relationship | Meaning                                |
| ------------ | -------------------------------------- |
| `self`       | The current resource                   |
| `next`       | Next page in paginated results         |
| `prev`       | Previous page in paginated results     |
| `status`     | Check the status of an async operation |
| `results`    | Retrieve completed results             |
| `related`    | Associated resources                   |

### Benefits

<CardGroup cols={2}>
  <Card title="No URL Hardcoding" icon="link-slash">
    Follow links instead of constructing URLs manually.
  </Card>

  <Card title="Discoverable Actions" icon="compass">
    The API tells you what you can do next.
  </Card>

  <Card title="Future-Proof" icon="shield-check">
    URL changes won't break your integration.
  </Card>

  <Card title="Self-Documenting" icon="book">
    Links include titles explaining each action.
  </Card>
</CardGroup>

### Pagination Example

List endpoints return pagination links:

```json theme={null}
{
  "response_type": "AnalysisPaginatedListResponse",
  "data": {
    "data": [...],
    "total": 150,
    "page": 2,
    "page_size": 50
  },
  "links": {
    "self": { "href": "/v1/analyses/?page=2", "rel": "self", "method": "GET" },
    "prev": { "href": "/v1/analyses/?page=1", "rel": "prev", "method": "GET" },
    "next": { "href": "/v1/analyses/?page=3", "rel": "next", "method": "GET" },
    "total": 150
  }
}
```

Follow the `next` link to get the next page—no need to calculate offsets yourself.
