> 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/keys/more/inverting-conditions-in-locksmith.md).

# Inverting conditions in Locksmith

There are many instances in which it is useful for a key to grant access if the *opposite* of your key condition is true.

Locksmith makes it easy to invert keys. To do so, simply click the box next to "invert" when you're editing the key:

<figure><img src="https://277214568-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MUeGWHuijBPr8Og1Gta%2Fuploads%2Fl5qMoCsq8O1IOQIOLxuo%2F2025-03-21%2013.09.00.gif?alt=media&amp;token=7a7830aa-55f9-44ff-bcb6-43388ff93c78" alt=""><figcaption></figcaption></figure>

Notice that when this is done, the wording will update, inverting the key condition logic:

<figure><img src="https://277214568-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MUeGWHuijBPr8Og1Gta%2Fuploads%2FtP28Tm0eEiQPgEul9hRV%2FScreenshot%202025-03-21%20at%201.09.41%E2%80%AFPM.png?alt=media&amp;token=582b814e-577d-4bb1-a197-d600061fae4c" alt=""><figcaption></figcaption></figure>

Make sure to "Save" the lock, and you're done!

As always, **feel free to contact us via email** at <team@uselocksmith.com>.<br>

{% hint style="info" %}
**A note on inverted customer account keys**

When you invert a [customer account key condition](/keys/customer-account-keys.md) — such as "is tagged with," "has purchased," or "email contains" — the inverted key will also grant access to visitors who are **not** signed in, since they technically meet the inverted condition — they have no customer account details (tags, email, purchase history, etc.) associated with them.

If you want to require sign-in, combine the inverted condition with an "is signed in" condition inside the same key:

[Combining key conditions](/keys/more/combining-key-conditions.md)
{% 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/keys/more/inverting-conditions-in-locksmith.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.
