> 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/tutorials/more/restricting-customers-to-a-specific-collection.md).

# Restricting customers to a specific collection

With Locksmith, it is simple to lock down a specific collection, so that it can only be viewed by a specific set of customers. However, some merchants want to take it one step further and make sure that those customers can *only* access their collection, while the rest of the store is restricted to them.

### Part 1: Create the collection lock

Add a lock to the collection that you want these customers to access. Use the search bar in Locksmith to search for the collection by name:<br>

<figure><img src="https://277214568-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MUeGWHuijBPr8Og1Gta%2Fuploads%2FsZTFva8k7LpvSZKhl7ds%2FScreenshot%202025-01-10%20at%202.17.27%20PM.png?alt=media&amp;token=42e4de68-5d58-4b59-9d2d-5c48ef562d38" alt=""><figcaption></figcaption></figure>

Under "Keys", choose how these customers will gain access. You can use whatever method of access you want. The most common way of granting access in this scenario is to use "customer tags" to grant access:

<figure><img src="https://277214568-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MUeGWHuijBPr8Og1Gta%2Fuploads%2FOkzWI5QPOxM4P2EEbEr5%2FScreenshot%202025-01-10%20at%202.18.44%20PM.png?alt=media&amp;token=00c40a82-303f-41cb-aef9-520f7678e3cd" alt=""><figcaption></figcaption></figure>

Make sure the "Force open other locks" setting is turned on for this lock. Use the following guide to do this: [Using the "Force open other locks" setting](/keys/more/using-the-force-open-other-locks-setting.md) . **This setting is important.**

<figure><img src="https://277214568-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MUeGWHuijBPr8Og1Gta%2Fuploads%2FIROSReoC6DcSFuPK8ZiY%2FScreenshot%202025-01-10%20at%202.19.26%20PM.png?alt=media&amp;token=c883397b-7c01-4303-8db9-584def30d72c" alt=""><figcaption></figcaption></figure>

### Part 2: Create a lock covering the rest of the store

In order to make sure that these customers can't see the rest of your store, you need to actually add a lock to your "entire store":

![](https://277214568-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MUeGWHuijBPr8Og1Gta%2Fuploads%2Fha2k5d3BxbCGxy34vdky%2FScreenshot%202025-01-10%20at%202.20.04%20PM.png?alt=media\&token=864d43a0-57f0-4372-b6c1-6027d4bc7482)

For your key condition, you need to use the "invert" option to obtain the opposite of the first key condition:

<figure><img src="https://277214568-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MUeGWHuijBPr8Og1Gta%2Fuploads%2FlFPK5qHIq3rd3R1rkIty%2FScreenshot%202025-01-10%20at%202.21.32%20PM.png?alt=media&amp;token=799ef1de-6088-4cfb-89f2-3eafdba09cb9" alt=""><figcaption><p>The invert option in the context of the rest of the key condition settings.</p></figcaption></figure>

Use the guide here if you need more guidance on how to invert your key condition:

{% content-ref url="/pages/WvgSxoLu5Yu2LN8UhkxS" %}
[Inverting conditions in Locksmith](/keys/more/inverting-conditions-in-locksmith.md)
{% endcontent-ref %}

{% hint style="info" %}
If this is a private collection, no further action necessary. If the collection is meant to be viewed by all customers, you'll also want to use the ["force open other locks](/keys/more/using-the-force-open-other-locks-setting.md)" setting on the lock for the entire store.
{% endhint %}


---

# 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/tutorials/more/restricting-customers-to-a-specific-collection.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.
