# How can I call Foundry APIs from Foundry itself?

**URL:** <https://community.palantir.com/t/how-can-i-call-foundry-apis-from-foundry-itself/6456>\
**Category:** Ask the Community\
**Tags:** osdk\
**Created:** [April 20, 2026, 8:26pm UTC](https://community.palantir.com/t/how-can-i-call-foundry-apis-from-foundry-itself/6456 "2026-04-20T20:26:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ckucera](https://avatars.discourse-cdn.com/v4/letter/c/f0a364/32.png) [@ckucera](https://community.palantir.com/u/ckucera)\
**Post date:** [April 20, 2026, 8:26pm UTC](https://community.palantir.com/t/how-can-i-call-foundry-apis-from-foundry-itself/6456/1 "2026-04-20T20:26:27Z")

</div>

For example, if I want to leverage ontology APIs, grab build history, or update users programmatically?

---

<div class="post-metadata">

**Author:** ![ckucera](https://avatars.discourse-cdn.com/v4/letter/c/f0a364/32.png) [@ckucera](https://community.palantir.com/u/ckucera)\
**Post date:** [April 20, 2026, 8:41pm UTC](https://community.palantir.com/t/how-can-i-call-foundry-apis-from-foundry-itself/6456/2 "2026-04-20T20:41:07Z")

</div>

## Background / Problem:

- You need to run some automated logic that hits Foundry Services.

- Right now you are storing your personal token as a secret on a REST API source OR you’ve written an external transform and are storing your personal token as a secret of that external transform.

* * *

## As an example, you want a Webhook that can Preregister a user to Multipass. And you want this to be executed automatically (via Automate). Note that for your example the set of scopes and permissions may be different! Edit them accordingly.

### Step 0: You determine that a Confidential Client 3PA is in fact the way to go.

- You realize that you want this to be run by an automation, and not by a privileged user’s action. Therefore, other alternatives such as setting up a 3PA Authorization Code Flow which checks the user’s own permissions to complete the preregistration task, or simply using the multipass UI directly to perform the task, are out.

- Now, you want to avoid creating a Service Account and generating a long-lived token, and you also want to avoid generating a long-lived token from a privileged human user. These would be suboptimal setups from a security and maintainability perspective.

- Therefore you conclude that an OAuth Confidential Client flow is the right solution.

### Step 1: [Research/Prework] Understand the permissions required to Preregister a User in Multipass and how to obtain them.

1. You investigate and you learn that preregistering a user to multipass requires elevated privileges. Specifically, it requires that your 3PA’s service user must have the `multipass:preregister-user` gatekeeper operation, on the Organization into which it will preregister users.

2. You learn that one way this operation is typically granted is through the `Manage Users and Groups` workflow granted to users assigned as `Users and groups administrators` in Control Panel → Organization Permissions.

 ![Screenshot 2024-07-12 at 3.44.26 PM.png](https://canada1.discourse-cdn.com/palantir/original/2X/b/b98e14dc81712a7d568fe604f25525920e91cb05.png)

### Step 2: Create a 3rd Party Application in Developer Console

- 

- 

- 

- Make sure to select “No, I won’t use an Ontology SDK”. This will create a non-OSDK 3PA. If you don’t, it will be an OSDK 3PA and will not support custom scopes such as `multipass:preregister-user`.

- You will be provided with a CLIENT SECRET and a CLIENT ID. We’ll need these soon.

### Step 3: Create a REST API Magritte Source

- The domain for the rest api should be your Foundry enrollment’s frontdoor. e.g. [https://stack.palantirfoundry.com](https://swirl.palantirfoundry.com)

- Probably, choose Direct Connection.

- Probably, add an Egress Policy to it, that refers back to the front door of your stack, over port 443 (e.g. [https://stack.palantirfoundry.com](https://swirl.palantirfoundry.com))

- Choose Authentication: None

- Add a Secret to it containing your CLIENT SECRET from Step 2.

- Add a Secret to it containing your CLIENT ID from Step 2.

### Step 4: Create a webhook from that REST API Source

Configure the webhook to perform the Client Credentials Handshake.

1. Follow the instructions here: [https://www.palantir.com/docs/foundry/data-connection/webhooks-reference/#build-a-webhook-that-performs-the-client-credentials-handshake](https://www.palantir.com/docs/foundry/data-connection/webhooks-reference/#build-a-webhook-that-performs-the-client-credentials-handshake)

2. The first call manually request an OAuth token. You will need to edit it to specify the scopes you are requesting for your token, via the OAuth Scope string (Screenshot below left)

3. The second call will have to be customized depending on which foundry endpoint you are trying to hit. In this case, the preregister users endpoint. You’ll also add an `email` Input Parameter to the webhook, and pass it to the API call, because that endpoint expects the user to provide an email address. (Screenshot below right)

 ![Screenshot 2026-04-20 at 4.36.02 PM](https://canada1.discourse-cdn.com/palantir/original/2X/e/e90503057b6ac1762f05dc9a3c457e3fdcd3d11c.png)

_Step 3. Rest API Source Setup_

 ![Screenshot 2026-04-20 at 4.37.52 PM](https://canada1.discourse-cdn.com/palantir/original/2X/f/fc43ff1e61d080aa6fcf64d46015d213799bf176.png)

_Step 4. Webhook configuration_

 ![Screenshot 2026-04-20 at 4.40.28 PM](https://canada1.discourse-cdn.com/palantir/original/2X/6/690e8967fec5664170121d4392289ce52352305b.png)

_Step 4. Webhook configuration_

### Step 5: Test your webhook and it fails with a Permission Error

- You test your webhook [https://www.palantir.com/docs/foundry/data-connection/webhooks-setup/#test-the-webhook](https://www.palantir.com/docs/foundry/data-connection/webhooks-setup/#test-the-webhook) but the webhook fails with a permission error.

- This makes sense for two reasons:

### Step 6: Fix the Permissions and the Scope

- You assign your Service User as a Users and Groups Administrator in Control Panel (if you are allowed to do so)

- You go to your 3PA’s Configuration in Dev Console and try to edit the scope

### Step 7: Test your webhook again and it succeeds

- You test your webhook again, and celebrate!

#### Step 8: Create the Action & the Automation

- You’re off to the races. You create an [Action backed by your Webhook](https://www.palantir.com/docs/foundry/action-types/set-up-webhook/#set-up-a-webhook) and you define an Automation in Automate to run your Action automatically in response to your desired triggers.

---

<div class="post-metadata">

**Author:** ![ckucera](https://avatars.discourse-cdn.com/v4/letter/c/f0a364/32.png) [@ckucera](https://community.palantir.com/u/ckucera)\
**Post date:** [May 28, 2026, 2:36pm UTC](https://community.palantir.com/t/how-can-i-call-foundry-apis-from-foundry-itself/6456/4 "2026-05-28T14:36:19Z")

</div>

Hi @9eab477d6eb76c06c4f6 , that is also a valid way to do things depending on how you’ve structured your implementation. No big difference AFAIK with either option.

---

<div class="post-metadata">

**Author:** ![9eab477d6eb76c06c4f6](https://yyz1.discourse-cdn.com/palantir/user_avatar/community.palantir.com/9eab477d6eb76c06c4f6/32/7919_2.png) [@9eab477d6eb76c06c4f6](https://community.palantir.com/u/9eab477d6eb76c06c4f6)\
**Post date:** [May 29, 2026, 1:37am UTC](https://community.palantir.com/t/how-can-i-call-foundry-apis-from-foundry-itself/6456/5 "2026-05-29T01:37:56Z")

</div>

> [@9eab477d6eb76c06c4f6](#):
>
> In your example, I don’t understand why you are not using the pre-configured 0Auth authentication from the REST API configuration ?

Thank you @ckucera for your feedback.

I just repost my question as I had to remove something:

 ![image](https://canada1.discourse-cdn.com/palantir/original/2X/2/26d6d9d780af62c42bd2a6026cba3a69c886f574.png)

“In your example, I don’t understand why you are not using the pre-configured 0Auth authentication from the REST API configuration ?”

---

<div class="post-metadata">

**Author:** ![system](https://yyz1.discourse-cdn.com/palantir/user_avatar/community.palantir.com/system/32/3_2.png) [@system](https://community.palantir.com/u/system)\
**Post date:** [August 28, 2026, 9:38am UTC](https://community.palantir.com/t/how-can-i-call-foundry-apis-from-foundry-itself/6456/6 "2026-08-28T09:38:33Z")

</div>

Closed on August 28, 2026, 9:38am UTC

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.
