Hi I'm evaluating <Permit.io> endpoints. Is there ...
# permit-saas
m
Hi I'm evaluating Permit.io endpoints. Is there an endpoint in permit.io that will answer the question: What action does User X have on Resource instance Z?
a
Hi @Michał Wójcik, I'm an AI assistant for Permit.io. I'll analyze available sources and get back to you shortly.
Yes, Permit.io provides the
permit.check()
function to determine if a user has permission to perform a specific action on a resource instance (1) (2) (3) (4) . This is the core authorization check endpoint. The check function evaluates whether a particular action by a user on a resource should be allowed or denied (5) . It accepts: • ​*User*​: The user ID • ​*Action*​: The operation being attempted • ​*Resource*​: The resource type or specific instance ID • ​*Context*​: Optional additional data for evaluation Here are examples of how to use it: ​*Node.js SDK:*​
Copy code
const permitted = await permit.check(user, action, resource) ;
(3) ​*With resource instance:*​
Copy code
const permitted = await permit.check(userId, action, `Resource:${resourceId}`) ;
(4) ​*API endpoint example:*​
Copy code
const permitted = await permit.check(user, action, resourceObj) ;
(3) ​*With context:*​
Copy code
const check = await permit.check(
  body.user,
  body.action, 
  body.resource,
  body.context
) ;
(4) The function returns a boolean indicating whether the user is permitted to perform the requested action (2) (3) . While
permit.check()
tells you if a specific action is allowed, if you need to know ​_all_​ actions a user can perform on a resource instance, you would need to check multiple actions individually or use bulk checking functionality (3) .
To learn more, see the sources I considered: [[1] How to Implement Dynamic React Feature Flags (2025 Update)](https://www.permit.io/blog/dynamic-react-feature-toggling-2024-guide) [[2] Implementing Authentication and Authorization in Next.js](https://www.permit.io/blog/implementing-authentication-and-authorization-in-nextjs) [[3] Implementing Role Based Access Control (RABC) in React](https://www.permit.io/blog/implementing-react-rbac-authorization) [[4] Authentication and Authorization with Firebase](https://www.permit.io/blog/authentication-and-authorization-with-firebase) [[5] How to Model (and Implement) Cloud-Native Authorization](https://www.permit.io/blog/how-to-model-and-implement-cloud-native-authorization)
o
AI gave a good answer. Note that this is a PDP endpoint as opposed to a control-plane endpoint @Ask Inkeep please clarify
a
Thanks for tagging me @Or Weis. I'll look through relevant sources and get back to you shortly.
* Yes, @Or Weis is correct - this is a PDP endpoint. The PDP (Policy Decision Point) is responsible for answering authorization queries (1) . To find what actions a user can perform on a resource, you have several PDP endpoints available: ​*For finding all actions a user can perform on a resource:*​
Copy code
curl -X POST <http://localhost:7766/v1/actions> \
-H "Content-Type: application/json" \
 -H "Authorization: Bearer YOUR_API_KEY" \
 -d '{
 "subject": {"type": "user", "id": "<mailto:alice@example.com|alice@example.com>"},
 "resource": {
 "type": "document",
 "id": "doc123",
 "properties": {"tenant": "default"}
 },
 }'
This returns:
{"actions": [{"name": "read"}, {"name": "write"}]}
The PDP runs as a microservice in your infrastructure (as a sidecar, cluster, or centralized deployment) and evaluates authorization queries using policies and contextual data . It's separate from the control plane which manages the policy configuration (2) . You can also use the standard
/allowed
endpoint to check specific actions, or
/allowed/bulk
for multiple checks at once (1) .
To learn more, see the sources I considered: [[1] Permit's PDP (Policy Decision Point)](https://docs.permit.io/concepts/pdp/overview) [[2] Control plane / Data plane](https://docs.permit.io/concepts/control-plane-and-data-plane)
o
Hey @Michał Wójcik The AI was almost right, the main authorization queries the PDP knows to answer are: • Can user
x
do action
y
on resources of type
z
( this means on all resource instances of this type ) ◦ via
permit.check(x,y,z)
( api ref, sdk ref ) • Can user
x
do action
y
on resource
z:z-instance
◦ via
permit.check(x,y,z:z-instance)
( api ref, sdk ref ) • What permissions does user
x
has with filters ◦ via
permit.get_user_permissions(x,tenants={optional tenant filter},resources={optional resources filter},resource_types={options resource types filter})
( api ref, sdk ref ) • Which users can perform action
y
on resources of type
z
◦ via
permit.get_authorized_users(y,z)
( api ref, sdk ref ) • Which users can perform action
y
on resource `z:z-instance`( this means on all resource instances of this type ) ◦ via
permit.get_authorized_users(y,z:z-instance)
( api ref, sdk ref ) There are few others that are good for more specific use-cases
m
The third bullet point answers this question, thanks a lot ! Authorized_users looks like a very useful endpoint and I will need it. I am trying to execute it, but I get an empty list of users. How can we debug this?
Copy code
curl --location '<http://localhost:7766/authorized_users>' \
--header 'Content-Type: application/json' \
--header 'Authorization: {{auth}}' \
--data '{   
    "action": "distribute",
    "resource": {
        "type": "market_order",
        "tenant":"default"
},
    "context": {
        "enable_abac_authorized_users": true
    }  
 }
}'

Result:
HTTP/1.1 200 OK
content-type: application/json
content-length: 59
connection: close
date: Wed, 06 Aug 2025 11:51:53 GMT

{
  "resource": "market_order:*",
  "tenant": "default",
  "users": {}
}
o
What is “the question” you are trying to ask ? Is it “Who can perform
distribute
on all resources of type
market_order
in tenant
default
?”
✅ 1
m
Correct
o
Can you attach the permit.check request that works for you ?
m
Copy code
curl --location '<http://localhost:7766/allowed>' \
--header 'Content-Type: application/json' \
--header 'Authorization: {{auth}}' \
--data '{
  "user": {
    "key": "<mailto:michal@clarksons.com|michal@clarksons.com>"
  },
  "action": "distribute",
  "resource": {
    "type": "market_order",
    "key": "m01",
    "tenant": "default"
  },
  "context": {}
}'

Response:
HTTP/1.1 200 OK
content-type: application/json
content-length: 1215
connection: close
date: Thu, 07 Aug 2025 06:19:05 GMT

{
  "allow": true,
  "debug": {
    "abac": {
      "allow": false,
      "code": "no_matching_rules",
      "matching_resourcesets": [
        "__autogen_market_order"
      ],
      "matching_usersets": [
        "__autogen_market_order"
      ],
      "reason": "user '<mailto:michal@clarksons.com|michal@clarksons.com>' does not match any rule that grants him the 'distribute' permission on the given resource of type 'market_order'",
      "support_link": "<https://docs.permit.io/errors/no_matching_rules>"
    },
    "rebac": {
      "allow": true,
      "allowing_roles": [
        {
          "reason": "granted by 'market_order:m01#creator'",
          "resource": "market_order:m01",
          "role": "market_order#creator",
          "sources": [
            {
              "type": "role_assignment"
            }
          ]
        }
      ],
      "code": "allow",
      "reason": "user '<mailto:michal@clarksons.com|michal@clarksons.com>' has the 'distribute' permission on resource 'market_order:m01' in tenant 'default', granted by 'market_order:m01#creator'"
    },
    "rbac": {
      "allow": false,
      "code": "no_user_roles",
      "reason": "no roles assigned to user '<mailto:michal@clarksons.com|michal@clarksons.com>'",
      "support_link": "<https://docs.permit.io/errors/no_user_roles>"
    },
    "request": {
      "action": "distribute",
      "resource": {
        "attributes": {
          "type": "market_order"
        },
        "type": "market_order"
      },
      "tenant": "default",
      "user": {
        "attributes": {
          "email": "<mailto:michal@clarksons.com|michal@clarksons.com>",
          "key": "<mailto:michal@clarksons.com|michal@clarksons.com>",
          "roles": [],
          "tenants": []
        },
        "key": "<mailto:michal@clarksons.com|michal@clarksons.com>",
        "synced": true
      }
    }
  },
  "result": false
}
o
The issue is that you authorized users query is on all resources of type market_order, so it returns only users with top level role or abac permissions that allows access to all resources of that type In the permit check you send the key, meaning you check on a specific resource instance, you should do the same to query all authorized users on that resource instance
✅ 1
m
I have two more questions. Let's imagine that I have a model company ->order->delivery. Now I would like to ask about all instances of order and delivery belonging to the company. Similarly, I would like to obtain all deliveries belonging to the order. How can I do this? And finally, I would like to ask about all resource instances owned by user X. @Ask Inkeep Could you help me?
a
Thanks for tagging me @Michał Wójcik. I'll look through relevant sources and get back to you shortly.
To model and query hierarchical relationships like company → order → delivery, you'll need to use ReBAC (Relationship-Based Access Control) with relationship tuples (1) . Setting Up the Relationships First, define relations between your resources. For example, for a folder-file hierarchy (2) :
Copy code
await permit.api.resource_relations.create(
    "file",
    {
        "key": "parent",
        "name": "Parent",
        "subject_resource": "folder",
    }
)
Creating Relationship Tuples To establish that resources belong to each other, create relationship tuples (1) :
Copy code
curl <https://api.permit.io/v2/facts/my_project/my_environment/relationship_tuples> \
  --request POST \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "subject": "organization:permitio",
    "relation": "owner",
    "object": "repo:test",
    "tenant": "public"
}'
The format is:
<Subject> : <Relation> : <Object>
Querying Resource Instances For finding resource instances owned by a user, you can use the
getUserPermissions
function (3) (4) :
Copy code
const tenants = await permit.api.tenants.list({
    perPage: 100,
}) ;
(4) This returns tenants where a user has assigned roles . For specific resource instances with relationships, you'd sync them with attributes (3) :
Copy code
const resourceInstance = await permit.api.resourceInstances.create({
    resource: "Transaction",
    key: transaction.id,
    tenant,
    attributes: {
        ...transaction,
    },
}) ;
Note that Permit.io's PDP focuses on authorization checks rather than resource discovery. The
getUserPermissions
endpoint can show what permissions a user has, but for full resource hierarchy queries (like "all deliveries belonging to an order") , you'd typically maintain that relationship data in your application database and use Permit.
To learn more, see the sources I considered: [[1] Sync Data into your App](https://docs.permit.io/overview/sync-applications-data) [[2] Modeling Google Drive Permissions with ReBAC](https://docs.permit.io/modeling/google-drive) [[3] Fintech / Banking Demo Application](https://docs.permit.io/modeling/mesa-verde) [[4] Fintech / Banking Demo Application](https://docs.permit.io/modeling/mesa-verde)
m
@Omer Zuarets @Or Weis Is AI right here?
Copy code
The getUserPermissions endpoint can show what permissions a user has, but for full resource hierarchy queries (like "all deliveries belonging to an order") , you'd typically maintain that relationship data in your application database and use <http://Permit.io|Permit.io> to authorize access to those resources.
o
Yes, the AI is correct - You can of course create a meta user that has all permissions; to map out everything via get-user permissions; and alternatively you can use the API to get all resource instances and their relationships. But you’d note these are not really about permissions. CC: @Alon Boshi
@Omer Zuarets - we can maybe consider adding this as a feature in the new PDP setup
o
Agree, will open a ticket for further discussion on this later in the project