Oauth 2.0 API Issue ServiceTitan - Works in postman

Hi all, I am having an issue initilizing a call to ServiceTitan to return a Auth token… Here is the documentation from ST :
330. Docs: Make Your First API Call - ServiceTitan API - developer portal

I have everything set up to this point, and Ive created an API in bubble api plugin


Ive also tried it by importing curl, and setting it up that way. Ive tried it with and without creating parameter brackets < > …etc…

Everytime I run I get

In postman, it works fine

Now, if I take the token from postman that is generated, I can use it and make API calls from Bubble this way:
(I fill the values from a form fill on the app)

What I am trying to accomplish is that the user on my SaaS app can connect to their service titan, and then use the data elsewhere in the app through api call actions.

I am thinking they need to connect (initialize the token) and then store the token to use in subsequent calls… this token refreshes but I am not there yet, right now, I want to get the call working…)

Any help would be appreciated. TIA! :frowning:

You’re passing the values as URL params i.e. https://…?grant_type=…&client_id=…

In postman, you’re passing them as data via the body. This would probably be the issue.

So yeah that screenshot was from a test changing it up but Ive done it this way, still same error

Am I missing something here?

Okay so I tried something different and still getting a 400 error. Here is what I did


I created it as a custom token, I created an API call because its the only way to make action for a workflow yeah?

I went ahead and did a manual response with the response from postman, I went and added a workflow,



The error I get is

If I can just get the token to work, the rest of the calls I make subsequently using the token are all working. :frowning:

Can anyone please walk me through this?

The first thing is that you should use Custom oAuth token instead of manually add the authorization token to all call. Probably you will pass the value as https://auth-integration.servicetitan.io/connect/token?grant_type=client_credentials&client_id=YOURCLIENTID&client_secret=YOURCLIENTSECRET (and maybe set the header for content-type= application/x-www-form-urlencoded (don’t use shared header but token call header. But this is probably not needed)

This way, you will not need to manually add authorization header to all call. Bubble will do it for you.

In the first screenshot, it probably didn’ work because you didn’t select POST… Also, shared header shouldn’t be set for the content-type: application/x-www-form-urlencoded. You will have a conflict with other call that will need application/json.

1 Like

On my last reply I had started using custom oauth token after realizing… but can you walk me through using the url a bit or point me to a resource?

UPDATE: Thanks for the guidance Jici I got it to work using

1 Like