# Build on anyshop

Products, stock, orders, licenses and webhooks of your store, over one REST API at api.anyshop.io. Payments go to your own accounts and wallets; anyshop delivers what was bought, exactly once, and tells your servers.

## Your first request

No key needed.

```bash
curl https://api.anyshop.io/v1
```

```json
{
  "object": "api",
  "version": "v1",
  "openapi": "https://api.anyshop.io/v1/openapi.json",
  "documentation": "https://docs.anyshop.io"
}
```

## Start here

- [Sell your first key with the API and a webhook](https://docs.anyshop.io/quickstart.md): Create a product, add keys, publish it, hear about the order on your server, then buy it once and refund it.
- [Take payments with Stripe](https://docs.anyshop.io/guides/stripe.md): Connect your own Stripe account with a restricted key, and buyers pay on Stripe's own page with every way to pay you turn on: cards, wallets, bank debits and more. anyshop takes 0%.
- [Check licenses in your app](https://docs.anyshop.io/guides/licenses.md): Activate a license on a device within its limit, validate it on launch, and work offline with a signed file.
- [React to orders on your servers](https://docs.anyshop.io/guides/webhooks.md): Standard Webhooks signatures, retries for 3 days, and replays of anything your server missed.
- [Sell from your own site](https://docs.anyshop.io/guides/headless-checkout.md): Your server starts a checkout, the buyer pays on Stripe's or PayPal's own page or anyshop's, and comes back to your pages. The amount always comes from your prices.
- [Sell with buy buttons on any site](https://docs.anyshop.io/guides/buy-buttons.md): One script tag and a button sell a product from any page. On your own sites, checkout opens in an overlay; anywhere else, in a new tab.
- [Deliver from your own server](https://docs.anyshop.io/guides/dynamic-delivery.md): When an order is paid, anyshop asks your server what the buyer gets, signed like a webhook, and delivers your answer: a code, some text or a link.

## The rules every call follows

Every endpoint in the reference behaves the same way, so its page only lists what is its own.

- [Authentication](https://docs.anyshop.io/reference.md#authentication): A Bearer API key from Developers, API keys. Every key is a live key for one store. Example: `Authorization: Bearer as_live_...`
- [Errors](https://docs.anyshop.io/reference.md#errors): Every error has the same body and a 4xx or 5xx status; param names the field at fault. Example: `{ "error": { "type", "code", "message", "param" } }`
- [Pagination](https://docs.anyshop.io/reference.md#pagination): Lists are newest first. Pass the last ID you got as starting_after for the next page. Example: `?limit=100&starting_after=ord_...`
- [Idempotency](https://docs.anyshop.io/reference.md#idempotency): Send an Idempotency-Key with a write: a retry within 24 hours gets the first answer and runs once. Example: `Idempotency-Key: 9b1c...`
- [Rate limits](https://docs.anyshop.io/reference.md#rate-limits): 1,000 requests a minute per key. Over it, 429 with Retry-After. Example: `Retry-After: 12`
- [Money and time](https://docs.anyshop.io/reference.md#money-and-time): Amounts are integers in minor units of the store currency. Times are ISO 8601, UTC. Example: `"price": 1999`

## API reference

Every endpoint is in the OpenAPI document, `GET https://api.anyshop.io/v1/openapi.json`.

- [Products](https://docs.anyshop.io/reference.md#products), 6 endpoints: Your catalog: create, change, publish and unpublish products.
- [Stock](https://docs.anyshop.io/reference.md#stock), 5 endpoints: Serial keys to sell. Full keys only through an audited reveal.
- [Coupons](https://docs.anyshop.io/reference.md#coupons), 5 endpoints: Codes buyers type at checkout. Catalog, like products: either key reads them, only a live key changes them.
- [Orders](https://docs.anyshop.io/reference.md#orders), 6 endpoints: What sold, refunds, taking back delivered items, the delivery email.
- [Customers](https://docs.anyshop.io/reference.md#customers), 4 endpoints: The people who bought from the store, and its customer records with their marketing consent. Records are live mode only. Erasing a customer and exporting their data stay in the dashboard, behind the owner's fresh two-factor check.
- [Checkout sessions](https://docs.anyshop.io/reference.md#checkout-sessions), 3 endpoints: Headless checkout: your server starts the checkout, your site's buyer pays on the step it names and comes back to your success_url.
- [Licenses](https://docs.anyshop.io/reference.md#licenses), 4 endpoints: Licenses, their devices and revocation.
- [Webhooks and events](https://docs.anyshop.io/reference.md#webhooks), 8 endpoints: Where events go, how they are signed, and the events of the last 30 days.
- [Exports](https://docs.anyshop.io/reference.md#exports), 2 endpoints: The store's data as a zip of JSON and CSV. Unsold keys are exported only from the dashboard.
- [Public license checks](https://docs.anyshop.io/reference.md#license-checks): Validate, activate and deactivate from your app. The license key is the credential: no API key ships with your software.
