Curl API to Trigger an Event Keeps giving me Error

Hello All,

I recently have been trying to use curl command to trigger an event in my application

I am running this command

user@Mahmoods-MacBook-Air ~ % curl "https://blynk.cloud/external/api/ping?token=*************"
{"error":{"message":"Invalid token."}}%

This is bizarre, I got the device token from the developer settings on the device and I even tried the region specific URLs, like “ny3.blynk.cloud” and so on, none of them worked. All the same error.

Screenshot 2025-05-13 at 11.28.23 PM

Maybe I am using the wrong key?

Anyone with curl experience fix/see this issue?

You’re using a command called “ping” which doesn’t appear to be a documented command for the Blynk HTTPS API.

You talk about “triggering an event”. Do you mean logging an event?
If so, then you need to have created the event, and you also need to be using the event code rather than the event name.
The syntax for the Log Event HTTPS command is described here:

It’s good practice to include the region subdomain in your server URL, but only one of them will work - the one where your Blynk account is located. You can obtain this info from the bottom right hand corner of web console screen, or from the “about” screen of the mobile app.

Pete.

Makes sense Pete that works, I did not realize our organization has a custom URL because its enterprise.

I got it to work now. By the way, why cant i trigger two of the same push notifications sequentially. I see the first one, but when I trigger the same push notification curl command a few minutes later it does not show on my device.

Is that by design? How can I change that aspect.

And thanks for your kind help!

I don’t know why.
It seems that you are saying that you have an enterprise subscription. If that’s the case then you should log a support ticket or speak to your account manager.

Pete.

1 Like

Hello @shillehtek

external/api/ping

we don’t support external HTTP api for ping command.

The hardware periodically sends a ping command to the server (every 45 seconds by default).

This may be related to the time set in the event settings. Please check this limit in event settings: