---
updatedAt: 2026-05-27T11:17:14.000Z
agentTools:
  projectIndex: https://developer.unloc.app/llms.txt
---

# Revoke Keys in Subproject

By default revokes all Keys in a Subproject. Use query parameters to filter what Keys to revoke.

- Use the `appUserId` parameter to revoke all Keys for a specific App User.
- Use the `lockId` parameter to revoke all Keys for a specific Lock.

Note:
- The endpoint will **not** revoke Access Group Keys. These can only be removed by removing users/locks from the relevant Access Groups using the Update Access Group Accesses endpoint.
- The endpoint will **not** revoke Keys shared by App Users. These can only be removed by using the [Revoke Shared Keys endpoint](ref:revokesharedkeysfromproject).

| | |
| --- | --- |
| Required Scope | `project.admin` |
| Required Module | `subproject` |


# OpenAPI definition

```json
{
  "openapi": "3.0.3",
  "info": {
    "title": "Unloc API",
    "version": "2.0",
    "description": "The Unloc API allows you to fully manage your Organizations and the belonging Projects.\n\nGetting started:\n\n1. Contact us to make an Organization and API Credentials for you. Make sure to not lose the client id/secret.\n2. Exchange your secret for a JWT using the [OAuth2 Token](ref:gettoken) endpoint.\n3. Create a Project to be managed by the Organization.\n4. Create a Lock Connection for the Project.\n5. Create Keys for your Users.\n\nAll the API endpoints in the Unloc API require a bearer token to be present in the authorization header, with the format authorization: \"Bearer [JWT]\".\n",
    "contact": {
      "name": "Jan Erik",
      "email": "janerik@unloc.app"
    }
  },
  "servers": [
    {
      "url": "https://api.unloc.app",
      "description": "Production server."
    }
  ],
  "tags": [
    {
      "name": "Keys",
      "description": "Key endpoints are used to get, create, and revoke keys to locks in the Project."
    }
  ],
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  },
  "paths": {
    "/v2/subprojects/{subprojectId}/keys": {
      "delete": {
        "summary": "Revoke Keys in Subproject",
        "description": "By default revokes all Keys in a Subproject. Use query parameters to filter what Keys to revoke.\n\n- Use the `appUserId` parameter to revoke all Keys for a specific App User.\n- Use the `lockId` parameter to revoke all Keys for a specific Lock.\n\nNote:\n- The endpoint will **not** revoke Access Group Keys. These can only be removed by removing users/locks from the relevant Access Groups using the Update Access Group Accesses endpoint.\n- The endpoint will **not** revoke Keys shared by App Users. These can only be removed by using the [Revoke Shared Keys endpoint](ref:revokesharedkeysfromproject).\n\n| | |\n| --- | --- |\n| Required Scope | `project.admin` |\n| Required Module | `subproject` |\n",
        "operationId": "revokeKeysInSubproject",
        "security": [
          {
            "BearerAuth": [
              "project.admin"
            ]
          }
        ],
        "tags": [
          "Keys"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "subprojectId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid v4"
            },
            "example": "b8b471d6-51f9-46f8-98bc-ed67423d6668",
            "description": "ID of the Subproject."
          },
          {
            "in": "query",
            "name": "appUserId",
            "required": false,
            "schema": {
              "type": "string",
              "format": "phone-number",
              "pattern": "^\\+?[1-9]\\d{1,14}$"
            },
            "example": "+61452912447",
            "description": "ID of the user. E.164 formatted mobile phone number you want to filter for."
          },
          {
            "in": "query",
            "name": "lockId",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid v4"
            },
            "example": "c0f3aed0-2a7e-4de5-a0ff-3bfc22bfbeef",
            "description": "ID of the Lock you want for filter for."
          },
          {
            "in": "query",
            "name": "notifyInvitee",
            "schema": {
              "type": "boolean"
            },
            "example": false,
            "description": "Should notify Key invitee that Key is revoked. Defaults to true."
          }
        ],
        "responses": {
          "200": {
            "description": "Returns the ids of the Keys the were revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "revokedKeyIds": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "description": "The IDs of the Keys that were revoked."
                      }
                    }
                  },
                  "required": [
                    "revokedKeyIds"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Request has missing or invalid parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Request has missing or invalid parameters.",
                  "properties": {
                    "type": {
                      "type": "string",
                      "description": "URI to the documentation for the error."
                    },
                    "title": {
                      "type": "string",
                      "description": "Human-readable summary of the error."
                    },
                    "detail": {
                      "type": "string",
                      "description": "Human-readable explanation specific to this occurrence of the problem."
                    },
                    "status": {
                      "type": "integer",
                      "example": 400,
                      "description": "HTTP status code for the error."
                    },
                    "traceContext": {
                      "type": "string",
                      "description": "A unique identifier for this error occurrence."
                    },
                    "invalidParams": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "The name of the invalid parameter.",
                            "example": "lockId"
                          },
                          "reason": {
                            "type": "string",
                            "description": "The reason why the parameter is invalid.",
                            "example": "must have required property 'lockId'"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized request. JWT invalid or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unauthorized request. JWT invalid or expired.",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Short identifier for the error.",
                      "example": "JsonWebTokenError"
                    },
                    "errorDescription": {
                      "type": "string",
                      "description": "Verbose description of the error meant for human consumption.",
                      "example": "JWT expired"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
```