{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"redocly_category":"Administration","product_name":"Control Panel","type":"markdown"},"seo":{"title":"Database-Scoped Column-Level Access Control","description":"Configure database-scoped column-level access control with the Treasure AI Permission Policy API to apply different column permission rules to each database.","siteUrl":"https://docs.treasure.ai","image":"/assets/treasure-ai-social-preview.e6fefb35676f6da91c2d1bc783bd39e618e7af2b1ad3aa52a96ae69d72e700fe.b1bff462.png","lang":"en-US","jsonLd":{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://www.treasure.ai/","name":"Treasure AI","url":"https://www.treasure.ai/","logo":"https://www.treasure.ai/hubfs/assets/images/logos/primary-logo.svg"},{"@type":"WebSite","@id":"https://docs.treasure.ai/#website","name":"Treasure AI Documentation","url":"https://docs.treasure.ai/","inLanguage":["en","ja"],"publisher":{"@id":"https://www.treasure.ai/"}}]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"database-scoped-column-level-access-control","__idx":0},"children":["Database-Scoped Column-Level Access Control"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Database-scoped column-level access control lets you apply column rules to specific databases rather than every database in the account. For example, you can allow only ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["non-PII"]}," columns in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["db1"]},", while allowing every column except ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PII"]}," in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["db2"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Before using this guide, read ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/control-panel/security/policies/policy-based-column-level-access-control-permissions"},"children":["Policy-Based Column-Level Access Control Permissions"]}," for the permission model and policy setup. This guide focuses on configuring the additional ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["scope"]}," setting through the Permission Policy API."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"prerequisites","__idx":1},"children":["Prerequisites"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/control-panel/security/policies/policy-based-column-level-access-control-permissions"},"children":["Policy-based column-level access control"]}," is enabled on your account. Contact your Customer Success representative if it isn't enabled."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["An administrator API key to update the policy."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"set-database-scoped-rules-on-a-policy","__idx":2},"children":["Set Database-Scoped Rules on a Policy"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The examples on this page use the US endpoint ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["https://api.treasuredata.com"]},". For other sites, see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/apis/endpoints/endpoints"},"children":["Treasure AI Sites and API Endpoints"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Add ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"scope\": {\"type\": \"db\", \"names\": [\"db1\"]}"]}," to a column rule to apply it only to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["db1"]},". To use the same rule in several databases, list their names in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["names"]},". Specify database names, not IDs. If you rename a database, update ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["scope.names"]}," to match. Without ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["scope"]},", the rule applies to every database."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PATCH /v3/access_control/policies/{policy_id}/column_permissions"]}," ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["replaces every column permission rule"]}," in the policy, scoped and unscoped. Include all existing rules you want to keep. Use the same endpoint to change or remove rules: update ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["scope.names"]}," to change the databases, omit ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["scope"]}," or set it to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]}," to apply a rule to every database, or leave a rule out of the list to remove it."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Replace ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<YOUR_ADMIN_API_KEY>"]}," with your administrator API key and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<POLICY_ID>"]}," with the policy ID you find in step 1. The following example sets two rules:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["In ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["db1"]},", users can view only columns tagged ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["non-PII"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["In ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["db2"]},", users can view every column except columns tagged ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PII"]},", including untagged columns."]}]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Find your policy ID by listing the policies:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -s -H \"Authorization: TD1 <YOUR_ADMIN_API_KEY>\" \\\n  https://api.treasuredata.com/v3/access_control/policies\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Find the policy by its ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["name"]}," in the response and use its ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["id"]}," as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<POLICY_ID>"]},". See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/control-panel/security/policies/permission-policy-api"},"children":["Permission Policy API"]},"."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Get the policy's current column permissions so you can keep the rules you still need."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -s -H \"Authorization: TD1 <YOUR_ADMIN_API_KEY>\" \\\n  \"https://api.treasuredata.com/v3/access_control/policies/<POLICY_ID>/column_permissions\"\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Send the rules you want to apply. The example below replaces the policy's column rules with the two scoped rules; add any existing rules you need to retain."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -s -X PATCH \\\n  -H \"Authorization: TD1 <YOUR_ADMIN_API_KEY>\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"column_permissions\": [\n      {\"tags\": [\"non-PII\"], \"except\": false, \"scope\": {\"type\": \"db\", \"names\": [\"db1\"]}},\n      {\"tags\": [\"PII\"], \"except\": true, \"scope\": {\"type\": \"db\", \"names\": [\"db2\"]}}\n    ]\n  }' \\\n  \"https://api.treasuredata.com/v3/access_control/policies/<POLICY_ID>/column_permissions\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The response returns the saved rules, including their database scopes."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Confirm the result by repeating the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET"]}," request from step 2. The response lists both rules with their ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["scope"]}," objects."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/control-panel/security/policies/applying-policies"},"children":["Apply the policy"]}," to the intended users if it isn't already assigned."]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["After the policies refresh, this example gives the following access, provided the user has database permissions and no other column rules grant additional access:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Column"},"children":["Column"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"In db1"},"children":["In ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["db1"]}]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"In db2"},"children":["In ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["db2"]}]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"In any other database"},"children":["In any other database"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Tagged ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["non-PII"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["View"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["View"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["None"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Tagged ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PII"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["None"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["None"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["None"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Untagged"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["None"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["View"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["None"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["time"]}," column stays readable, as with all column-level access control."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"usage-notes","__idx":3},"children":["Usage Notes"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Mixing scoped and unscoped rules is not recommended when you need strict per-database access. For example, a user has both of these rules in their assigned policies:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"[\n  {\"tags\": [\"non-PII\"], \"except\": false, \"scope\": {\"type\": \"db\", \"names\": [\"db1\"]}},\n  {\"tags\": [\"PII\"], \"except\": true}\n]\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The first rule allows only ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["non-PII"]},"-tagged columns in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["db1"]},". However, the second rule allows columns without ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PII"]}," in every database, including untagged columns in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["db1"]},". The user can therefore read untagged columns in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["db1"]},", despite the first rule."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To allow only ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["non-PII"]},"-tagged columns in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["db1"]},", remove the second rule or add ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"scope\": {\"type\": \"db\", \"names\": [\"db2\"]}"]}," to it so it applies only to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["db2"]},". Check that no other policy assigned to the user allows additional columns in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["db1"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"limitations","__idx":4},"children":["Limitations"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["API only."]}," You can't view, create, edit, or remove database-scoped rules in Treasure Console. Use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PATCH /v3/access_control/policies/{policy_id}/column_permissions"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Database names."]}," Each ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["names"]}," list takes 1 to 100 database names. Database names follow the standard Treasure AI database naming rules."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"related-topics","__idx":5},"children":["Related Topics"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/control-panel/security/policies/policy-based-column-level-access-control-permissions"},"children":["Policy-Based Column-Level Access Control Permissions"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/control-panel/security/tag-management/tag-based-access-control-using-the-rest-api"},"children":["Tag-Based Access Control Using the REST API"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/control-panel/security/tag-management/about-column-level-access-control"},"children":["About Column-Level Access Control"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/control-panel/security/policies/permission-policy-api"},"children":["Permission Policy API"]}]}]}]},"headings":[{"value":"Database-Scoped Column-Level Access Control","id":"database-scoped-column-level-access-control","depth":1},{"value":"Prerequisites","id":"prerequisites","depth":2},{"value":"Set Database-Scoped Rules on a Policy","id":"set-database-scoped-rules-on-a-policy","depth":2},{"value":"Usage Notes","id":"usage-notes","depth":2},{"value":"Limitations","id":"limitations","depth":2},{"value":"Related Topics","id":"related-topics","depth":2}],"frontmatter":{"seo":{"title":"Database-Scoped Column-Level Access Control","description":"Configure database-scoped column-level access control with the Treasure AI Permission Policy API to apply different column permission rules to each database."}},"lastModified":"2026-11-17T03:49:42.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/products/control-panel/security/policies/database-scoped-column-level-access-control","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}