> For the complete documentation index, see [llms.txt](https://www.locksmith.guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.locksmith.guide/developer-tools/locksmith-admin-api.md).

# Locksmith Admin API

Locksmith's Admin API can be used to query Locksmith to get information about your locks, keys, and settings. As a REST API, it closely resembles [Shopify's own REST Admin API](https://shopify.dev/docs/api/admin-rest).

{% hint style="warning" %}
Locksmith's Admin API is not intended for use in themes or user-facing browser experiences. For that, use Locksmith's [Storefront API](/developer-tools/locksmith-storefront-api.md). Any client-side browser Javascript calling the Admin API will encounter [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS) errors.
{% endhint %}

## Versions

We maintain a 1-to-1 relationship with Shopify's API versions. Any [current and valid Shopify API versions](https://app.shopify.com/services/apis.json) are also current and valid Locksmith versions.

Read more about [Shopify's versioning philosophy](https://shopify.dev/docs/api/usage/versioning).

{% hint style="success" %}
For simplicity, the use of `unstable` as the version when calling this API will work for most use-cases.
{% endhint %}

## Authentication

There are two required headers:

| Header                     | Description                                                            |
| -------------------------- | ---------------------------------------------------------------------- |
| `x-shopify-shop-domain`    | Must be of the format "example.myshopify.com"                          |
| `x-locksmith-access-token` | Must be an enabled access token, generated in your Locksmith settings. |

Using cURL, one might access the API this way:

```
curl \
   --header "x-shopify-shop-domain: example.myshopify.com" \
   --header "x-locksmith-access-token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
   https://uselocksmith.com/api/unstable/shop.json
```

## Endpoints

All requests should be prefixed with **<https://uselocksmith.com/api/:version>**

#### Input lists

* <mark style="color:green;">`POST`</mark> `/input-lists/:id/sync`\
  Requests an input list sync for the input list indicated by the ID

#### Installs

* <mark style="color:green;">`POST`</mark> `/install`\
  Requests a full Locksmith installation to the *currently published* theme

#### Locks

* <mark style="color:purple;">`GET`</mark> `/locks.json`\
  Returns an array of all locks in your Locksmith account
* <mark style="color:purple;">`GET`</mark> `/locks/:id.json`\
  Returns data for a single lock in your Locksmith account
* <mark style="color:green;">`POST`</mark> `/lock/`\
  Creates a lock (single- or multi-resource). [See full documentation](/more-developer-docs/using-the-admin-api-with-locks.md).
* <mark style="color:red;">`DELETE`</mark> `/locks/:id`\
  Deletes the lock indicated by the ID
* <mark style="color:green;">`POST`</mark> `/locks/:lock_id/resources`\
  Attaches a resource to an existing lock. [See documentation](/more-developer-docs/using-the-admin-api-with-locks.md).
* <mark style="color:blue;">`PATCH`</mark> `/locks/:lock_id/resources/:lock_resource_id`\
  Updates a resource attached to a lock
* <mark style="color:red;">`DELETE`</mark> `/locks/:lock_id/resources/:lock_resource_id`\
  Detaches a resource from a lock

#### Shop

* <mark style="color:purple;">`GET`</mark> `/shop.json`\
  Returns Locksmith's entire configuration for your store

## Conventions

* Do not rely upon data keys that are prefixed with an underscore (e.g. "\_foobar"). They are subject to change or removal at any time.

## Generating an access token

To access this API, generate an access token. You can find these toward the end of your settings area:

![](https://277214568-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MUeGWHuijBPr8Og1Gta%2Fuploads%2FklKIhJuxnfYdR8s8SgJZ%2FAPIAccessToken.png?alt=media\&token=1eba0c07-fe4a-41ac-a805-5baa20ab40b8)

Use the "Add access token" link to add your first token.

Once created, an access token may be edited to enable/disable it, or to change its name. It may also be deleted.<br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.locksmith.guide/developer-tools/locksmith-admin-api.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
