# Cloud API

Manage your projects and coding-agent sessions programmatically with the SpecStory Cloud REST and GraphQL APIs.

Use the Cloud API to build integrations, retrieve conversation history, and search the sessions you sync to SpecStory Cloud. Start with REST for project and session operations, or use GraphQL to query across your data.

## Base URL

Send requests to `https://cloud.specstory.com`.

Include your API key as a Bearer token in the `Authorization` header. The [authentication guide](https://docs.specstory.com/api-reference/authentication) explains how to obtain a key and use it from your preferred language.

## API overview

### REST API

Use individual endpoints to work with projects and sessions:

-   **Projects:** [list projects](https://docs.specstory.com/api-reference/projects/list-projects), [update their details](https://docs.specstory.com/api-reference/projects/update-project), or [delete a project](https://docs.specstory.com/api-reference/projects/delete-project).
-   **Sessions:** [list sessions in a project](https://docs.specstory.com/api-reference/sessions/list-sessions), [retrieve a conversation](https://docs.specstory.com/api-reference/sessions/get-session), or [get recent sessions](https://docs.specstory.com/api-reference/sessions/get-recent-sessions) across projects.
-   **Conditional requests:** [check a session](https://docs.specstory.com/api-reference/sessions/check-session) before downloading its content.

Each endpoint includes its HTTP method, path, parameters, response fields, and request examples.

### GraphQL API

Use [GraphQL](https://docs.specstory.com/api-reference/graphql) when you need full-text search, metadata filters, or selected fields from related projects and sessions. Send queries to `POST /api/v1/graphql`.

The [query examples](https://docs.specstory.com/api-reference/graphql-examples) cover full-text search, project filters, and more advanced queries. You can also explore the schema in the [GraphQL explorer](https://cloud.specstory.com/api/v1/graphql).

## Key features

### ETags and conditional requests

Session responses include an `ETag` that identifies the content version. Send it in `If-None-Match` on a later request to avoid downloading unchanged content. A matching version returns `304 Not Modified`. See [Get Session](https://docs.specstory.com/api-reference/sessions/get-session) and [Check Session](https://docs.specstory.com/api-reference/sessions/check-session).

### JSON and Markdown

Retrieve structured session data as JSON or the conversation itself as Markdown. The [Get Session reference](https://docs.specstory.com/api-reference/sessions/get-session) documents the available formats and response fields.

### Session metadata

Use client details, git context, model information, and tags to understand and organize your history. The [GraphQL overview](https://docs.specstory.com/api-reference/graphql) explains how to select and filter the fields you need.

## Rate limits

The Cloud API documents these limits per API key:

| Interface | Requests per hour |
| --- | --- |
| REST API | 1,000 |
| GraphQL API | 500 |

Read `X-RateLimit-Limit`, `X-RateLimit-Remaining`, and `X-RateLimit-Reset` from responses to track your current allowance. The reset value is a UTC Unix timestamp in seconds. See [error handling](https://docs.specstory.com/api-reference/errors#rate-limiting) for handling `429` responses and retrying requests.

## Getting started

1.  Sign in to [SpecStory Cloud](https://cloud.specstory.com) and [create an API key](https://docs.specstory.com/api-reference/authentication).
2.  List your projects with an authenticated request:

cURL

```bash
curl -H "Authorization: Bearer YOUR_API_KEY" \
  https://cloud.specstory.com/api/v1/projects
```

3.  Use a project ID from the response to [list its sessions](https://docs.specstory.com/api-reference/sessions/list-sessions).
4.  [Retrieve a session](https://docs.specstory.com/api-reference/sessions/get-session), or try the [GraphQL examples](https://docs.specstory.com/api-reference/graphql-examples) to search your history.

## SDKs and libraries

Use an HTTP client or GraphQL library with these endpoints. The reference includes cURL, JavaScript, and Python examples; the [authentication guide](https://docs.specstory.com/api-reference/authentication#making-authenticated-requests) also includes Go.

## Support

Check the [error reference](https://docs.specstory.com/api-reference/errors) for status codes and recovery steps. For API help, email [support@specstory.com](mailto:support@specstory.com). Report documentation issues on [GitHub](https://github.com/specstoryai/getspecstory/issues).

---

Source: [Cloud API | SpecStory Docs](https://docs.specstory.com/api-reference/introduction)
