What Hash Algo is used to create the Hash IDs for clients?

Hi,

We use another platform to export invoice totals into an API to create invoices in Invoice Ninja.
But to do this we need the Client Hash IDs.
We already have the un-hashed IDs in our other platform.
So my question is, what algorithm is used to create the hashed IDs, so that I can use the same Hash Algorithm within my API process to match up the clients.

Thanks,
Anthony.

Hi,

@david can you please advise?

You should not need the actual.primary key ever, you will want to match the client on the number column as this is unique.

I was using Make.com to create the API flows and instead of the id number it used the hash code instead. If it’s not by design in your API I guess it’s Make’s issue.

I’ll look into creating these API flows with Python instead.

Thanks,
Anthony.

@Ant

Just to clarify, you should be able to match a field from your client to make and then it can then search onto invoice ninja to find the match.

You could use the number column or even insert your client ID value into a custom value in invoice ninja and then match on those columns to find the correct client?

1 Like

@david

Unfortunately, it seems every built-in Invoice Ninja call in Make.com uses hashed IDs, e.g. to find or get a client I need to provide the Hashed ID, to update an Invoice I need to provide Hashed IDs for the invoice, etc…
I would have to do a custom API call and find it that way. It’s just annoying Make.com choose to use the Hashed IDs for everything when the unique standard ID would have been suffice and easier to provide.

Thanks for your help.

Cheers,
Anthony.

@david
Sorry, me again.

I checked the ninja API call to get a client and it also needs the hashed ID.
You mentioned:
“Just to clarify, you should be able to match a field from your client to make and then it can then search onto invoice ninja to find the match.”
By the way, I know how to match columns in Make etc, I’m using Make to read in a list of clients and normal IDs from another system. Even though those IDs are in Invoice Ninja, I can’t search on that field. It has to be the Hashed ID.

How do I search for a client, without having to provide a hashed ID.
Can you give me a Curl command showing how to search for client based on some other field, like normal ID, Name or Custom field etc.
Or if you can tell me what Hash algorithm Invoice Ninja uses, I can just use that same Algorithm to get the Hash for the normal ID within the Workflow.

Cheers,
Ant.

@Ant

You mention this:

 Even though those IDs are in Invoice Ninja

I’m interested to know which ID this is referencing? As we do not expose our primary IDs at all to any service, including Make.

For searching here are some options

curl -X GET 'https://invoicing.co/api/v1/clients?client_id=xxxxxxxxxxxxxx' \
-H "X-API-TOKEN:TOKEN" \
-H "X-Requested-With: XMLHttpRequest";
curl -X GET 'https://invoicing.co/api/v1/clients?number=xxxxxxxxxxxxxx' \
-H "X-API-TOKEN:TOKEN" \
-H "X-Requested-With: XMLHttpRequest";
curl -X GET 'https://invoicing.co/api/v1/clients?id_number=xxxxxxxxxxxxxx' \
-H "X-API-TOKEN:TOKEN" \
-H "X-Requested-With: XMLHttpRequest";
curl -X GET 'https://invoicing.co/api/v1/clients?email=jim@bob.com' \
-H "X-API-TOKEN:TOKEN" \
-H "X-Requested-With: XMLHttpRequest";

The response from all of these will be an array, so you’ll want to pluck the first client in the array for your match.

1 Like

@david

“I’m interested to know which ID this is referencing? As we do not expose our primary IDs at all to any service, including Make.”

Sorry, I should have explained more. I was referring to the “id_number”.
When we imported all our clients into Invoice ninja we populated this “id_number” field with the ID Number from our other project platform. That’s what I meant when I said I have a CSV with “client” IDs from our Project platform that also exist in Invoice Ninja. These are not Hashed, but are unique in Invoice Ninja. I was hoping to be able to make API calls using these IDs. But I couldn’t because I had to use the Hashed IDs. This was my issue.

I looked up the GET call on the API Docs, and it seemed that it required a Hash ID as well.
GET /api/v1/clients/{id}
I didn’t see where to use the GET call as a search feature that could use any fields like in your examples. Sorry if I read it wrong, my bad.

UPDATE: I think the API Docs have been updated, as it doesn’t show just the {ID} now, it lists all the possible fields you can search clients for :slight_smile:
Invoice Ninja API Spec

This GET example you gave me works perfectly, I was able to use this API call in Make to search for our Client’s “id_number”, then pull the hashed ID.

GET ‘https://invoicing.co/api/v1/clients?id_number=xxxxxxxxxxxxxx

Thanks again for all your help, and sorry for dragging out this solution and your time :slight_smile:

Cheers,
Anthony.

@Ant

Great to hear it is working!