From 438ab581fa500dad0520f8af57744c2cc016115e Mon Sep 17 00:00:00 2001 From: jackshim415 Date: Fri, 20 Nov 2026 15:49:39 -0800 Subject: [PATCH 1/2] docs(learn): guide readers through their first API request Refs: LVT-237 --- apps/learn/astro.config.mjs | 4 ++ .../src/content/docs/guides/lovat-api.md | 38 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 apps/learn/src/content/docs/guides/lovat-api.md diff --git a/apps/learn/astro.config.mjs b/apps/learn/astro.config.mjs index 984bd15da..027f38256 100644 --- a/apps/learn/astro.config.mjs +++ b/apps/learn/astro.config.mjs @@ -62,6 +62,10 @@ export default defineConfig({ }, ], }, + { + label: "Lovat API", + items: [{ label: "Getting Started", slug: "guides/lovat-api" }], + }, ], components: { Header: "./src/components/Header.astro", diff --git a/apps/learn/src/content/docs/guides/lovat-api.md b/apps/learn/src/content/docs/guides/lovat-api.md new file mode 100644 index 000000000..e86b09679 --- /dev/null +++ b/apps/learn/src/content/docs/guides/lovat-api.md @@ -0,0 +1,38 @@ +--- +title: Getting Started with the Lovat API +description: Authenticate and make your first read request to the Lovat API. +--- + +Use the Lovat API to look up teams and tournaments from a script or integration. The examples below use the production API at `https://api.lovat.app`. + +## Authenticate + +Send your credential in the `Authorization` header as a bearer token. Use an `lvt-` API key for scripts that support key authentication. The [API reference](https://api.lovat.app/v1/doc/) lists the authentication, parameters, and permissions for each operation. + +If you need a key, use the **Create a new API key** operation under **Manager - API Keys** in the reference. Creating a key requires an Auth0 access token for a signed-in account on a verified Lovat team. Enter a name that identifies the integration. Save the returned `apiKey` in your integration's secret store. The list operation returns metadata, so copy the key when you create it. Revoke it in the reference if it is exposed. + +## Look up a team + +Set `LOVAT_API_KEY` in your shell from your secret store, then run this request. It searches by team-number prefix and limits the response to five teams. + +```sh +curl --silent --show-error --fail-with-body \ + --header "Authorization: Bearer ${LOVAT_API_KEY:?Set LOVAT_API_KEY}" \ + --header 'X-Lovat-Error-Format: json-v1' \ + 'https://api.lovat.app/v1/manager/teams?filter=8033&take=5' +``` + +On success, the response has a `teams` array and a `count` field. If the search has no matches, the array is empty. + +## Handle errors + +`X-Lovat-Error-Format: json-v1` requests structured errors. Use the HTTP status and `code` for decisions and `message` for readable feedback. + +| Status | What to check | +| ------ | -------------------------------------------------------------------------------------------------------------- | +| `400` | Check the endpoint's parameters and any field names listed in `invalidFields`. | +| `401` | Check the bearer header and whether the credential is still valid. | +| `403` | Check the account's permissions and whether the operation requires an Auth0 access token. | +| `429` | Wait for `Retry-After` or `retryAfterSeconds` when provided. Space API-key requests by at least three seconds. | + +For other endpoints and their response schemas, see the [interactive API reference](https://api.lovat.app/v1/doc/) or the [OpenAPI JSON specification](https://api.lovat.app/v1/doc.json). From abc0c67e787c9100c04022a150940186e35aeb59 Mon Sep 17 00:00:00 2001 From: jackshim415 Date: Fri, 20 Nov 2026 21:32:55 -0800 Subject: [PATCH 2/2] docs(learn): explain how to reach the API before getting a key Refs: LVT-237 --- apps/learn/src/content/docs/guides/lovat-api.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/learn/src/content/docs/guides/lovat-api.md b/apps/learn/src/content/docs/guides/lovat-api.md index e86b09679..f73265ebc 100644 --- a/apps/learn/src/content/docs/guides/lovat-api.md +++ b/apps/learn/src/content/docs/guides/lovat-api.md @@ -5,11 +5,19 @@ description: Authenticate and make your first read request to the Lovat API. Use the Lovat API to look up teams and tournaments from a script or integration. The examples below use the production API at `https://api.lovat.app`. +## Check the API connection + +Make a read-only request to the public status endpoint. It returns `Server running` when the API is reachable. + +```sh +curl --fail-with-body https://api.lovat.app/status +``` + ## Authenticate Send your credential in the `Authorization` header as a bearer token. Use an `lvt-` API key for scripts that support key authentication. The [API reference](https://api.lovat.app/v1/doc/) lists the authentication, parameters, and permissions for each operation. -If you need a key, use the **Create a new API key** operation under **Manager - API Keys** in the reference. Creating a key requires an Auth0 access token for a signed-in account on a verified Lovat team. Enter a name that identifies the integration. Save the returned `apiKey` in your integration's secret store. The list operation returns metadata, so copy the key when you create it. Revoke it in the reference if it is exposed. +For help getting your first credential, [contact the Lovat maintainers](https://lovat.app/contact). The API reference accepts an existing access token or key. If you already have an Auth0 access token for the Lovat API and your account is on a verified team, open the reference, select **Authorize**, and enter the token in **bearerAuth**. Then use **Create a new API key** under **Manager - API Keys** and give the key a name that identifies the integration. Save the returned `apiKey` in your integration's secret store. The list operation returns metadata, so copy the key when you create it. Revoke it in the reference if it is exposed. ## Look up a team