Issues with Ledger API

My first challenge is understanding how the API organization user operates in the sandbox environment.

Currently, I’m using the sandbox and don’t have access to an explicit organizationID. However, it appears that the API bearer access token needs to have organization-level permissions to perform data requests.

To reach the Teams page, I have to navigate through a product first, then access Teams. This setup has led me to believe that the access token should have the correct permissions, especially since the API username includes an org+ prefix.

Additionally, when testing in Postman with the access token, I’m not receiving any data in response. Despite, seemingly, having the token set up correctly, all API requests return empty responses. I’d appreciate any guidance on how to ensure that the access token is recognized by the API in sandbox mode and whether there are specific configurations needed to retrieve data successfully.


Hey @gpatt1 what I notice right away is that you're getting a 404 not found error instead of something that might indicate a lack of permissions. Can you confirm that your values in the URL are correct? Maybe try hard coding the URL as a test?

I get the {"ok":false,"error":"Not Found"} from the first api.

Hi @gpatt1 we're looking into this internally.

It seems the docs are incorrect and /v1/users/ledgers does not exist. Instead the dashboard uses /v1/ledgers to list the user's ledgers.

The route you'll want is /v1/products/:productIdOrSlug/ledgers to get the ledgers associated with a product. However, this is also not yet documented. In addition it seems this route is not yet working as required. I'm working with our cloud engineers to get this updated as soon as possible.

In the meantime, /v1/ledgers should work with a user token NOT an API user token.

Thanks for your patience on this.

Hi Eric,

Thank you. On the product level this did work using

https://api.particle.io/v1/products/:productIdOrSlug/ledgers

Can you clarify the difference between an access token and an API User access token? In this case the regular access token worked for the api call, but the organizational level API user access token did not.

r

The POST apis with updated productID and access token are working well.

List Ledger Instances

https://api.particle.io/v1/products/:productID/ledgers/:ledgerName/instances

Variables: Product ID, Ledger Name
Access Token: User access token
Test: Working :white_check_mark:

Get Ledger Instances

https://api.particle.io/v1/products/:productID/ledgers/:ledgerName/instances/:scopeValue

Variables: Product ID, Ledger Name, scopeValue (coreid)
Access Token: User access token
Test: Working :white_check_mark:

List Ledger Instance Versions

https://api.particle.io/v1/products/:productID/ledgers/:ledgerName/instances/:scopeValue/versions

Variables: Product ID, Ledger Name, scopeValue (coreid)
Access Token: User access token
Test: Working :white_check_mark:

List Ledger Definitions

https://api.particle.io/v1/products/:productID/ledgers/:ledgerName

Variables: Product ID, Ledger Name
Access Token: User access token
Test: Working :white_check_mark:

API level user access tokens are generally preferred as they can be more tightly scoped. You can read more about them here.