> ## Documentation Index
> Fetch the complete documentation index at: https://docs.turnkey.com/llms.txt
> Use this file to discover all available pages before exploring further.

# API reference

> Review our [API Introduction](/developer-reference/api-overview/intro) to get started.

export const tags = [{
  "id": "consensus",
  "label": "Consensus"
}, {
  "id": "broadcasting",
  "label": "Broadcasting"
}, {
  "id": "on-ramp",
  "label": "On Ramp"
}, {
  "id": "tvc",
  "label": "TVC"
}, {
  "id": "user-auth",
  "label": "User Auth"
}, {
  "id": "api-keys",
  "label": "API keys"
}, {
  "id": "authenticators",
  "label": "Authenticators"
}, {
  "id": "invitations",
  "label": "Invitations"
}, {
  "id": "policies",
  "label": "Policies"
}, {
  "id": "private-key-tags",
  "label": "Private Key Tags"
}, {
  "id": "private-keys",
  "label": "Private Keys"
}, {
  "id": "sessions",
  "label": "Sessions"
}, {
  "id": "organizations",
  "label": "Organizations"
}, {
  "id": "user-tags",
  "label": "User Tags"
}, {
  "id": "users",
  "label": "Users"
}, {
  "id": "wallets",
  "label": "Wallets"
}, {
  "id": "user-recovery",
  "label": "User Recovery"
}, {
  "id": "user-verification",
  "label": "User Verification"
}, {
  "id": "ip-allowlist",
  "label": "IP Allowlist"
}, {
  "id": "features",
  "label": "Features"
}, {
  "id": "signing",
  "label": "Signing"
}, {
  "id": "boot-proof",
  "label": "Boot Proof"
}, {
  "id": "activities",
  "label": "Activities"
}, {
  "id": "send-transactions",
  "label": "Send Transactions"
}, {
  "id": "app-proof",
  "label": "App Proof"
}];

export const endpoints = [{
  "name": "Approve activity",
  "id": "approve-activity",
  "type": "activity",
  "tags": [{
    "id": "consensus",
    "label": "Consensus"
  }]
}, {
  "name": "Broadcast EVM transaction",
  "id": "broadcast-evm-transaction",
  "type": "activity",
  "tags": [{
    "id": "broadcasting",
    "label": "Broadcasting"
  }]
}, {
  "name": "Broadcast SVM transaction",
  "id": "broadcast-svm-transaction",
  "type": "activity",
  "tags": [{
    "id": "broadcasting",
    "label": "Broadcasting"
  }]
}, {
  "name": "Create a Fiat On Ramp Credential",
  "id": "create-a-fiat-on-ramp-credential",
  "type": "activity",
  "tags": [{
    "id": "on-ramp",
    "label": "On Ramp"
  }]
}, {
  "name": "Create a TVC App",
  "id": "create-a-tvc-app",
  "type": "activity",
  "tags": [{
    "id": "tvc",
    "label": "TVC"
  }]
}, {
  "name": "Create a TVC Deployment",
  "id": "create-a-tvc-deployment",
  "type": "activity",
  "tags": [{
    "id": "tvc",
    "label": "TVC"
  }]
}, {
  "name": "Create an OAuth 2.0 Credential",
  "id": "create-an-oauth-2-0-credential",
  "type": "activity",
  "tags": [{
    "id": "user-auth",
    "label": "User Auth"
  }]
}, {
  "name": "Create API keys",
  "id": "create-api-keys",
  "type": "activity",
  "tags": [{
    "id": "api-keys",
    "label": "API Keys"
  }]
}, {
  "name": "Create authenticators",
  "id": "create-authenticators",
  "type": "activity",
  "tags": [{
    "id": "authenticators",
    "label": "Authenticators"
  }]
}, {
  "name": "Create invitations",
  "id": "create-invitations",
  "type": "activity",
  "tags": [{
    "id": "invitations",
    "label": "Invitations"
  }]
}, {
  "name": "Create Oauth providers",
  "id": "create-oauth-providers",
  "type": "activity",
  "tags": [{
    "id": "user-auth",
    "label": "User Auth"
  }]
}, {
  "name": "Create policies",
  "id": "create-policies",
  "type": "activity",
  "tags": [{
    "id": "policies",
    "label": "Policies"
  }]
}, {
  "name": "Create policy",
  "id": "create-policy",
  "type": "activity",
  "tags": [{
    "id": "policies",
    "label": "Policies"
  }]
}, {
  "name": "Create private key tag",
  "id": "create-private-key-tag",
  "type": "activity",
  "tags": [{
    "id": "private-key-tags",
    "label": "Private Key Tags"
  }]
}, {
  "name": "Create private keys",
  "id": "create-private-keys",
  "type": "activity",
  "tags": [{
    "id": "private-keys",
    "label": "Private Keys"
  }]
}, {
  "name": "Create read only session",
  "id": "create-read-only-session",
  "type": "activity",
  "tags": [{
    "id": "sessions",
    "label": "Sessions"
  }]
}, {
  "name": "Create read write session",
  "id": "create-read-write-session",
  "type": "activity",
  "tags": [{
    "id": "sessions",
    "label": "Sessions"
  }]
}, {
  "name": "Create smart contract interface",
  "id": "create-smart-contract-interface",
  "type": "activity",
  "tags": [{
    "id": "policies",
    "label": "Policies"
  }]
}, {
  "name": "Create sub-organization",
  "id": "create-sub-organization",
  "type": "activity",
  "tags": [{
    "id": "organizations",
    "label": "Organizations"
  }]
}, {
  "name": "Create TVC Manifest Approvals",
  "id": "create-tvc-manifest-approvals",
  "type": "activity",
  "tags": [{
    "id": "tvc",
    "label": "TVC"
  }]
}, {
  "name": "Create user tag",
  "id": "create-user-tag",
  "type": "activity",
  "tags": [{
    "id": "user-tags",
    "label": "User Tags"
  }]
}, {
  "name": "Create users",
  "id": "create-users",
  "type": "activity",
  "tags": [{
    "id": "users",
    "label": "Users"
  }]
}, {
  "name": "Create wallet",
  "id": "create-wallet",
  "type": "activity",
  "tags": [{
    "id": "wallets",
    "label": "Wallets"
  }]
}, {
  "name": "Create wallet accounts",
  "id": "create-wallet-accounts",
  "type": "activity",
  "tags": [{
    "id": "wallets",
    "label": "Wallets"
  }]
}, {
  "name": "Create webhook endpoint",
  "id": "create-webhook-endpoint",
  "type": "activity",
  "tags": [{
    "id": "organizations",
    "label": "Organizations"
  }]
}, {
  "name": "Delete a Fiat On Ramp Credential",
  "id": "delete-a-fiat-on-ramp-credential",
  "type": "activity",
  "tags": [{
    "id": "on-ramp",
    "label": "On Ramp"
  }]
}, {
  "name": "Delete a TVC App and all of its deployments",
  "id": "delete-a-tvc-app-and-all-of-its-deployments",
  "type": "activity",
  "tags": [{
    "id": "tvc",
    "label": "TVC"
  }]
}, {
  "name": "Delete a TVC Deployment",
  "id": "delete-a-tvc-deployment",
  "type": "activity",
  "tags": [{
    "id": "tvc",
    "label": "TVC"
  }]
}, {
  "name": "Delete an OAuth 2.0 Credential",
  "id": "delete-an-oauth-2-0-credential",
  "type": "activity",
  "tags": [{
    "id": "user-auth",
    "label": "User Auth"
  }]
}, {
  "name": "Delete API keys",
  "id": "delete-api-keys",
  "type": "activity",
  "tags": [{
    "id": "api-keys",
    "label": "API Keys"
  }]
}, {
  "name": "Delete authenticators",
  "id": "delete-authenticators",
  "type": "activity",
  "tags": [{
    "id": "authenticators",
    "label": "Authenticators"
  }]
}, {
  "name": "Delete invitation",
  "id": "delete-invitation",
  "type": "activity",
  "tags": [{
    "id": "invitations",
    "label": "Invitations"
  }]
}, {
  "name": "Delete Oauth providers",
  "id": "delete-oauth-providers",
  "type": "activity",
  "tags": [{
    "id": "user-auth",
    "label": "User Auth"
  }]
}, {
  "name": "Delete policies",
  "id": "delete-policies",
  "type": "activity",
  "tags": [{
    "id": "policies",
    "label": "Policies"
  }]
}, {
  "name": "Delete policy",
  "id": "delete-policy",
  "type": "activity",
  "tags": [{
    "id": "policies",
    "label": "Policies"
  }]
}, {
  "name": "Delete private key tags",
  "id": "delete-private-key-tags",
  "type": "activity",
  "tags": [{
    "id": "private-key-tags",
    "label": "Private Key Tags"
  }]
}, {
  "name": "Delete private keys",
  "id": "delete-private-keys",
  "type": "activity",
  "tags": [{
    "id": "private-keys",
    "label": "Private Keys"
  }]
}, {
  "name": "Delete smart contract interface",
  "id": "delete-smart-contract-interface",
  "type": "activity",
  "tags": [{
    "id": "policies",
    "label": "Policies"
  }]
}, {
  "name": "Delete sub-organization",
  "id": "delete-sub-organization",
  "type": "activity",
  "tags": [{
    "id": "organizations",
    "label": "Organizations"
  }]
}, {
  "name": "Delete user tags",
  "id": "delete-user-tags",
  "type": "activity",
  "tags": [{
    "id": "user-tags",
    "label": "User Tags"
  }]
}, {
  "name": "Delete users",
  "id": "delete-users",
  "type": "activity",
  "tags": [{
    "id": "users",
    "label": "Users"
  }]
}, {
  "name": "Delete wallet accounts",
  "id": "delete-wallet-accounts",
  "type": "activity",
  "tags": [{
    "id": "wallets",
    "label": "Wallets"
  }]
}, {
  "name": "Delete wallets",
  "id": "delete-wallets",
  "type": "activity",
  "tags": [{
    "id": "wallets",
    "label": "Wallets"
  }]
}, {
  "name": "Delete webhook endpoint",
  "id": "delete-webhook-endpoint",
  "type": "activity",
  "tags": [{
    "id": "organizations",
    "label": "Organizations"
  }]
}, {
  "name": "Export private key",
  "id": "export-private-key",
  "type": "activity",
  "tags": [{
    "id": "private-keys",
    "label": "Private Keys"
  }]
}, {
  "name": "Export wallet",
  "id": "export-wallet",
  "type": "activity",
  "tags": [{
    "id": "wallets",
    "label": "Wallets"
  }]
}, {
  "name": "Export wallet account",
  "id": "export-wallet-account",
  "type": "activity",
  "tags": [{
    "id": "wallets",
    "label": "Wallets"
  }]
}, {
  "name": "Import private key",
  "id": "import-private-key",
  "type": "activity",
  "tags": [{
    "id": "private-keys",
    "label": "Private Keys"
  }]
}, {
  "name": "Import wallet",
  "id": "import-wallet",
  "type": "activity",
  "tags": [{
    "id": "wallets",
    "label": "Wallets"
  }]
}, {
  "name": "Init email recovery",
  "id": "init-email-recovery",
  "type": "activity",
  "tags": [{
    "id": "user-recovery",
    "label": "User Recovery"
  }]
}, {
  "name": "Init fiat on ramp",
  "id": "init-fiat-on-ramp",
  "type": "activity",
  "tags": [{
    "id": "on-ramp",
    "label": "On Ramp"
  }]
}, {
  "name": "Init generic OTP",
  "id": "init-generic-otp",
  "type": "activity",
  "tags": [{
    "id": "user-verification",
    "label": "User Verification"
  }]
}, {
  "name": "Init import private key",
  "id": "init-import-private-key",
  "type": "activity",
  "tags": [{
    "id": "private-keys",
    "label": "Private Keys"
  }]
}, {
  "name": "Init import wallet",
  "id": "init-import-wallet",
  "type": "activity",
  "tags": [{
    "id": "wallets",
    "label": "Wallets"
  }]
}, {
  "name": "Init OTP auth",
  "id": "init-otp-auth",
  "type": "activity",
  "tags": [{
    "id": "user-auth",
    "label": "User Auth"
  }]
}, {
  "name": "Login with a stamp",
  "id": "login-with-a-stamp",
  "type": "activity",
  "tags": [{
    "id": "sessions",
    "label": "Sessions"
  }]
}, {
  "name": "Login with Oauth",
  "id": "login-with-oauth",
  "type": "activity",
  "tags": [{
    "id": "sessions",
    "label": "Sessions"
  }]
}, {
  "name": "Login with OTP",
  "id": "login-with-otp",
  "type": "activity",
  "tags": [{
    "id": "sessions",
    "label": "Sessions"
  }]
}, {
  "name": "Oauth",
  "id": "oauth",
  "type": "activity",
  "tags": [{
    "id": "user-auth",
    "label": "User Auth"
  }]
}, {
  "name": "OAuth 2.0 authentication",
  "id": "oauth-2-0-authentication",
  "type": "activity",
  "tags": [{
    "id": "user-auth",
    "label": "User Auth"
  }]
}, {
  "name": "OTP auth",
  "id": "otp-auth",
  "type": "activity",
  "tags": [{
    "id": "user-auth",
    "label": "User Auth"
  }]
}, {
  "name": "Perform email auth",
  "id": "perform-email-auth",
  "type": "activity",
  "tags": [{
    "id": "user-auth",
    "label": "User Auth"
  }]
}, {
  "name": "Recover a user",
  "id": "recover-a-user",
  "type": "activity",
  "tags": [{
    "id": "user-recovery",
    "label": "User Recovery"
  }]
}, {
  "name": "Reject activity",
  "id": "reject-activity",
  "type": "activity",
  "tags": [{
    "id": "consensus",
    "label": "Consensus"
  }]
}, {
  "name": "Remove IP Allowlist",
  "id": "remove-ip-allowlist",
  "type": "activity",
  "tags": [{
    "id": "ip-allowlist",
    "label": "IP Allowlist"
  }]
}, {
  "name": "Remove organization feature",
  "id": "remove-organization-feature",
  "type": "activity",
  "tags": [{
    "id": "features",
    "label": "Features"
  }]
}, {
  "name": "Restore a TVC Deployment",
  "id": "restore-a-tvc-deployment",
  "type": "activity",
  "tags": [{
    "id": "tvc",
    "label": "TVC"
  }]
}, {
  "name": "Set IP Allowlist",
  "id": "set-ip-allowlist",
  "type": "activity",
  "tags": [{
    "id": "ip-allowlist",
    "label": "IP Allowlist"
  }]
}, {
  "name": "Set organization feature",
  "id": "set-organization-feature",
  "type": "activity",
  "tags": [{
    "id": "features",
    "label": "Features"
  }]
}, {
  "name": "Sign raw payload",
  "id": "sign-raw-payload",
  "type": "activity",
  "tags": [{
    "id": "signing",
    "label": "Signing"
  }]
}, {
  "name": "Sign raw payloads",
  "id": "sign-raw-payloads",
  "type": "activity",
  "tags": [{
    "id": "signing",
    "label": "Signing"
  }]
}, {
  "name": "Sign transaction",
  "id": "sign-transaction",
  "type": "activity",
  "tags": [{
    "id": "signing",
    "label": "Signing"
  }]
}, {
  "name": "Update a Fiat On Ramp Credential",
  "id": "update-a-fiat-on-ramp-credential",
  "type": "activity",
  "tags": [{
    "id": "on-ramp",
    "label": "On Ramp"
  }]
}, {
  "name": "Update an OAuth 2.0 Credential",
  "id": "update-an-oauth-2-0-credential",
  "type": "activity",
  "tags": [{
    "id": "user-auth",
    "label": "User Auth"
  }]
}, {
  "name": "Update organization name",
  "id": "update-organization-name",
  "type": "activity",
  "tags": [{
    "id": "organizations",
    "label": "Organizations"
  }]
}, {
  "name": "Update policy",
  "id": "update-policy",
  "type": "activity",
  "tags": [{
    "id": "policies",
    "label": "Policies"
  }]
}, {
  "name": "Update private key tag",
  "id": "update-private-key-tag",
  "type": "activity",
  "tags": [{
    "id": "private-key-tags",
    "label": "Private Key Tags"
  }]
}, {
  "name": "Update root quorum",
  "id": "update-root-quorum",
  "type": "activity",
  "tags": [{
    "id": "organizations",
    "label": "Organizations"
  }]
}, {
  "name": "Update user",
  "id": "update-user",
  "type": "activity",
  "tags": [{
    "id": "users",
    "label": "Users"
  }]
}, {
  "name": "Update user tag",
  "id": "update-user-tag",
  "type": "activity",
  "tags": [{
    "id": "user-tags",
    "label": "User Tags"
  }]
}, {
  "name": "Update user's email",
  "id": "update-user-s-email",
  "type": "activity",
  "tags": [{
    "id": "users",
    "label": "Users"
  }]
}, {
  "name": "Update user's name",
  "id": "update-user-s-name",
  "type": "activity",
  "tags": [{
    "id": "users",
    "label": "Users"
  }]
}, {
  "name": "Update user's phone number",
  "id": "update-user-s-phone-number",
  "type": "activity",
  "tags": [{
    "id": "users",
    "label": "Users"
  }]
}, {
  "name": "Update wallet",
  "id": "update-wallet",
  "type": "activity",
  "tags": [{
    "id": "wallets",
    "label": "Wallets"
  }]
}, {
  "name": "Update webhook endpoint",
  "id": "update-webhook-endpoint",
  "type": "activity",
  "tags": [{
    "id": "organizations",
    "label": "Organizations"
  }]
}, {
  "name": "Verify generic OTP",
  "id": "verify-generic-otp",
  "type": "activity",
  "tags": [{
    "id": "user-verification",
    "label": "User Verification"
  }]
}, {
  "name": "Get a specific boot proof",
  "id": "get-a-specific-boot-proof",
  "type": "query",
  "tags": [{
    "id": "boot-proof",
    "label": "Boot Proof"
  }]
}, {
  "name": "Get activity",
  "id": "get-activity",
  "type": "query",
  "tags": [{
    "id": "activities",
    "label": "Activities"
  }]
}, {
  "name": "Get API key",
  "id": "get-api-key",
  "type": "query",
  "tags": [{
    "id": "api-keys",
    "label": "API keys"
  }]
}, {
  "name": "Get API keys",
  "id": "get-api-keys",
  "type": "query",
  "tags": [{
    "id": "api-keys",
    "label": "API keys"
  }]
}, {
  "name": "Get authenticator",
  "id": "get-authenticator",
  "type": "query",
  "tags": [{
    "id": "authenticators",
    "label": "Authenticators"
  }]
}, {
  "name": "Get authenticators",
  "id": "get-authenticators",
  "type": "query",
  "tags": [{
    "id": "authenticators",
    "label": "Authenticators"
  }]
}, {
  "name": "Get balances",
  "id": "get-balances",
  "type": "query",
  "tags": [{
    "id": "wallets",
    "label": "Wallets"
  }]
}, {
  "name": "Get configs",
  "id": "get-configs",
  "type": "query",
  "tags": [{
    "id": "organizations",
    "label": "Organizations"
  }]
}, {
  "name": "Get gas usage",
  "id": "get-gas-usage",
  "type": "query",
  "tags": [{
    "id": "broadcasting",
    "label": "Broadcasting"
  }]
}, {
  "name": "Get IP Allowlist",
  "id": "get-ip-allowlist",
  "type": "query",
  "tags": [{
    "id": "ip-allowlist",
    "label": "IP Allowlist"
  }]
}, {
  "name": "Get nonces",
  "id": "get-nonces",
  "type": "query",
  "tags": [{
    "id": "broadcasting",
    "label": "Broadcasting"
  }]
}, {
  "name": "Get OAuth 2.0 credential",
  "id": "get-oauth-2-0-credential",
  "type": "query",
  "tags": []
}, {
  "name": "Get Oauth providers",
  "id": "get-oauth-providers",
  "type": "query",
  "tags": [{
    "id": "user-auth",
    "label": "User Auth"
  }]
}, {
  "name": "Get On Ramp transaction status",
  "id": "get-on-ramp-transaction-status",
  "type": "query",
  "tags": [{
    "id": "on-ramp",
    "label": "On Ramp"
  }]
}, {
  "name": "Get policy",
  "id": "get-policy",
  "type": "query",
  "tags": [{
    "id": "policies",
    "label": "Policies"
  }]
}, {
  "name": "Get policy evaluations",
  "id": "get-policy-evaluations",
  "type": "query",
  "tags": [{
    "id": "activities",
    "label": "Activities"
  }]
}, {
  "name": "Get private key",
  "id": "get-private-key",
  "type": "query",
  "tags": [{
    "id": "private-keys",
    "label": "Private Keys"
  }]
}, {
  "name": "Get send transaction status",
  "id": "get-send-transaction-status",
  "type": "query",
  "tags": [{
    "id": "send-transactions",
    "label": "Send Transactions"
  }]
}, {
  "name": "Get smart contract interface",
  "id": "get-smart-contract-interface",
  "type": "query",
  "tags": [{
    "id": "policies",
    "label": "Policies"
  }]
}, {
  "name": "Get sub-organizations",
  "id": "get-sub-organizations",
  "type": "query",
  "tags": [{
    "id": "organizations",
    "label": "Organizations"
  }]
}, {
  "name": "Get the latest boot proof for an app",
  "id": "get-the-latest-boot-proof-for-an-app",
  "type": "query",
  "tags": [{
    "id": "boot-proof",
    "label": "Boot Proof"
  }]
}, {
  "name": "Get TVC App",
  "id": "get-tvc-app",
  "type": "query",
  "tags": [{
    "id": "tvc",
    "label": "TVC"
  }]
}, {
  "name": "Get TVC App status",
  "id": "get-tvc-app-status",
  "type": "query",
  "tags": [{
    "id": "tvc",
    "label": "TVC"
  }]
}, {
  "name": "Get TVC Deployment",
  "id": "get-tvc-deployment",
  "type": "query",
  "tags": [{
    "id": "tvc",
    "label": "TVC"
  }]
}, {
  "name": "Get user",
  "id": "get-user",
  "type": "query",
  "tags": [{
    "id": "users",
    "label": "Users"
  }]
}, {
  "name": "Get verified sub-organizations",
  "id": "get-verified-sub-organizations",
  "type": "query",
  "tags": [{
    "id": "organizations",
    "label": "Organizations"
  }]
}, {
  "name": "Get wallet",
  "id": "get-wallet",
  "type": "query",
  "tags": [{
    "id": "wallets",
    "label": "Wallets"
  }]
}, {
  "name": "Get wallet account",
  "id": "get-wallet-account",
  "type": "query",
  "tags": [{
    "id": "wallets",
    "label": "Wallets"
  }]
}, {
  "name": "List activities",
  "id": "list-activities",
  "type": "query",
  "tags": [{
    "id": "activities",
    "label": "Activities"
  }]
}, {
  "name": "List App Proofs for an activity",
  "id": "list-app-proofs-for-an-activity",
  "type": "query",
  "tags": [{
    "id": "app-proof",
    "label": "App Proof"
  }]
}, {
  "name": "List Fiat On Ramp Credentials",
  "id": "list-fiat-on-ramp-credentials",
  "type": "query",
  "tags": [{
    "id": "on-ramp",
    "label": "On Ramp"
  }]
}, {
  "name": "List OAuth 2.0 Credentials",
  "id": "list-oauth-2-0-credentials",
  "type": "query",
  "tags": [{
    "id": "user-auth",
    "label": "User Auth"
  }]
}, {
  "name": "List policies",
  "id": "list-policies",
  "type": "query",
  "tags": [{
    "id": "policies",
    "label": "Policies"
  }]
}, {
  "name": "List private key tags",
  "id": "list-private-key-tags",
  "type": "query",
  "tags": [{
    "id": "private-key-tags",
    "label": "Private Key Tags"
  }]
}, {
  "name": "List private keys",
  "id": "list-private-keys",
  "type": "query",
  "tags": [{
    "id": "private-keys",
    "label": "Private Keys"
  }]
}, {
  "name": "List smart contract interfaces",
  "id": "list-smart-contract-interfaces",
  "type": "query",
  "tags": [{
    "id": "policies",
    "label": "Policies"
  }]
}, {
  "name": "List supported assets",
  "id": "list-supported-assets",
  "type": "query",
  "tags": [{
    "id": "wallets",
    "label": "Wallets"
  }]
}, {
  "name": "List TVC Apps",
  "id": "list-tvc-apps",
  "type": "query",
  "tags": [{
    "id": "tvc",
    "label": "TVC"
  }]
}, {
  "name": "List TVC Deployments",
  "id": "list-tvc-deployments",
  "type": "query",
  "tags": [{
    "id": "tvc",
    "label": "TVC"
  }]
}, {
  "name": "List user tags",
  "id": "list-user-tags",
  "type": "query",
  "tags": [{
    "id": "user-tags",
    "label": "User Tags"
  }]
}, {
  "name": "List users",
  "id": "list-users",
  "type": "query",
  "tags": [{
    "id": "users",
    "label": "Users"
  }]
}, {
  "name": "List wallets",
  "id": "list-wallets",
  "type": "query",
  "tags": [{
    "id": "wallets",
    "label": "Wallets"
  }]
}, {
  "name": "List wallets accounts",
  "id": "list-wallets-accounts",
  "type": "query",
  "tags": [{
    "id": "wallets",
    "label": "Wallets"
  }]
}, {
  "name": "List webhook endpoints",
  "id": "list-webhook-endpoints",
  "type": "query",
  "tags": [{
    "id": "organizations",
    "label": "Organizations"
  }]
}, {
  "name": "Validate Container Image for TVC",
  "id": "validate-container-image-for-tvc",
  "type": "query",
  "tags": [{
    "id": "tvc",
    "label": "TVC"
  }]
}, {
  "name": "Who am I",
  "id": "who-am-i",
  "type": "query",
  "tags": [{
    "id": "sessions",
    "label": "Sessions"
  }]
}];

export const EndpointFilter = ({endpoints, tags}) => {
  const filterId = `endpoint-filter-${Math.random().toString(36).slice(2, 9)}`;
  const handleTagClick = value => {
    const rootEl = document.getElementById(filterId);
    if (!rootEl) return;
    const filterTags = rootEl.getAttribute('data-filter-tags') || '';
    const filterTagsArray = filterTags.split(',').filter(Boolean);
    const isType = ["all", "query", "activity"].includes(value);
    if (isType) {
      rootEl.setAttribute('data-filter-type', value);
    } else {
      if (filterTagsArray.includes(value)) {
        filterTagsArray.splice(filterTagsArray.indexOf(value), 1);
      } else {
        filterTagsArray.push(value);
      }
      rootEl.setAttribute('data-filter-tags', filterTagsArray.join(','));
    }
    const rows = rootEl.querySelectorAll('.endpoint-row');
    rows.forEach(r => {
      const tagsAttr = r.getAttribute('data-tags') || '';
      const tags = tagsAttr.split(',').filter(Boolean);
      const matchesTags = filterTagsArray.length === 0 || filterTagsArray.some(f => tags.includes(f));
      const rowType = r.getAttribute('data-endpoint-type') || 'all';
      const currentType = rootEl.getAttribute('data-filter-type');
      const matchesType = currentType === 'all' || rowType === currentType;
      r.style.display = matchesTags && matchesType ? 'block' : 'none';
    });
    const pills = rootEl.querySelectorAll('.endpoint-tag');
    pills.forEach(p => {
      if (p.hasAttribute('data-endpoint-type')) {
        const type = p.getAttribute('data-endpoint-type');
        if (type === rootEl.getAttribute('data-filter-type')) {
          p.style.backgroundColor = 'rgb(var(--primary-light))';
          p.style.color = 'white';
        } else {
          p.style.removeProperty('background-color');
          p.style.removeProperty('color');
        }
      } else {
        const tagId = p.getAttribute('data-tag');
        if (filterTagsArray.includes(tagId)) {
          p.style.backgroundColor = 'rgb(var(--primary-light))';
          p.style.color = 'white';
        } else {
          p.style.removeProperty('background-color');
          p.style.removeProperty('color');
        }
      }
    });
  };
  return <div>
<div className="flex flex-col gap-4" id={filterId} data-filter-tags="" data-filter-type="all">
<div className="flex flex-row gap-2 flex-wrap items-center">

          {tags.sort((a, b) => a.label.localeCompare(b.label)).map(tag => <span data-tag={tag.id} onClick={() => handleTagClick(tag.id)} className="endpoint-tag select-none h-8 text-xs px-2 cursor-pointer bg-gray-100/50 dark:bg-white/10 inline-flex items-center justify-center rounded-full text-gray-600 dark:text-gray-200 font-medium">
              {tag.label}
            </span>)}
        </div>
        <div className="flex flex-col pb-12 min-h-dvh">
          {endpoints.sort((a, b) => a.name.localeCompare(b.name)).map(endpoint => <div className="endpoint-row" data-tags={endpoint.tags.map(t => t.id).join(",")} data-endpoint-type={endpoint.type}>
              <span onClick={() => {
    window.location.href = `${endpoint.type === "query" ? "queries" : "activities"}/${endpoint.id}`;
  }} className="cursor-pointer py-2 font-normal border-b border-gray-100 dark:border-gray-700 group flex flex-row justify-between items-start md:items-center">
                <div className="flex flex-row gap-2 items-start md:items-center font-normal items-center">
                  <div className="">{endpoint.name}</div>

                  <span class="px-1 py-0.5 rounded text-[0.55rem] leading-tight font-bold bg-gray-100/50 dark:bg-white/5 text-gray-600 dark:text-gray-200">
                    {endpoint.type}
                  </span>
                </div>
                <div className="flex flex-row gap-2">
                  {endpoint.tags.map(tag => <span key={tag.id} style={{
    padding: "0 10px",
    letterSpacing: "0.025rem"
  }} className="inline-flex h-6 items-center text-xs rounded-full bg-gray-100/50 dark:bg-white/5 text-gray-600 dark:text-gray-200 font-medium break-all">
                      <span className="tracking-wide">{tag.label}</span>
                    </span>)}
                </div>
              </span>
            </div>)}
        </div>

      </div>
    </div>;
};

<EndpointFilter endpoints={endpoints} tags={tags} />
