TimelineAPI: "User id could not be resolved" (HTTP 400)




I'm using the Timeline API right after getting an accessToken in order to create new event types. I get the following error:

StatusCodeError: 400 - {"status":"error","message":"User id could not be resolved","correlationId":"e08e83a0-020a-457e-895a-xxx","requestId":"fe5ecb959a986c41fe31e692c7xxx"}

I double checked and my API calls actually have my own User ID (from the developer dashboard where I found the HAPIKey). Is the User ID supposed to be the actually ID from the user who is connecting or my own developer user ID? I'm asking because the same API call works if connect with my own developer account. The documentation says otherwise. Can someone please help?


Edit: The app was private at first. I thought that was the issue but even with a new, public hubspot app, it didn't resolve the issue


@Connor_Barley I was mistaken - the action did not resolve my issue. I thought for a minute it did but it's still the same. Can someone from HubSpot help? Here are more details:

The API response:

    "status": "error",
    "message": "User id could not be resolved",
    "correlationId": "1e21af7d-69c9-4c77-8f42-xxx",
    "requestId": "2db4cc66071898dc03d14aexxx"

Here's my API call:

curl -X POST \
  'http://api.hubapi.com/integrations/v1/[appId]/timeline/event-types?userId=[developerUserId]' \
  -H 'Authorization: Bearer xxx' \
  -H 'Content-Type: application/json' \
  -H 'cache-control: no-cache' \
  -d '{
	"applicationId": "[appId]",
	"detailTemplate": "[Show Campaign]({{campaignUrl}})",
	"headerTemplate": "Campaign updated",
	"name": "Campaign updated",
	"objectType": "CONTACT"

The application is public, the userId is form my developer account.


Hi @agraebe, no problem!

Can you reply with your App ID and example request URL/Body you're making to HubSpot(just exclude your developer api key)?

You can also create event types via your developer account's UI as an aside.


I edited the comment above - is that enough? I can also get you the details through DM if that helps.

I saw the UI feature, too. Does that mean I have to create the templates only one time and for my developer account and not for every user who's connecting?


Hi @agraebe, no unfortunately I'll need to see what your App ID is. Looks like you omitted that info (its not sensitive so it's safe to post here).

Correct. The templates you create in your developer account would be created once. You can then create timeline events based off those templates.


Here is my app Id: 186659.

I'm going to change my implementation based on the learning that I can just create the templates once. Makes it much easier. However, the error seems to be unrelated. Maybe you could see what might be the cause?


Hi @agraebe, yep that's what I'm looking into. I think the issue is that you're using an Oauth token. You wouldn't need to generate one for this action. Per these docs: https://developers.hubspot.com/docs/methods/timeline/create-event-type, you should just use your developer Api key and your user id. You'd grab that info from this page by clicking "Get HAPIkey". then make a request like so:

https://api.hubapi.com/integrations/v1/186659/timeline/event-types?hapikey=XXXXX&userId=4416162 with a body, for example, of:

  "name":"New Event Type",
  "headerTemplate":"# Title for event {{id}}\nThis is an event for {{objectType}}",
  "detailTemplate":"This event happened on {{#formatDate timestamp}}{{/formatDate}}"