function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Dilip MantripragadaDilip Mantripragada 

Is it possible to Define/Create a Platform event via APIs or Metadata API?

Hi ,

I am new to this and I am trying to understand if in the first place one can Define or create a new Paltform Event itself via any of the Salesforce REST/SOAP APIs/MetaData API. Please note that I am not asking about publisihng events or subscribing to them via API 
All I am asking is if PEs can be created/defined via any APIs.

Dilip M
Hi Dilip,

I am not completely sure if i understand your question.
But Platform Events are similar to Custom objects. You can deploy or retrieve them using Metadata API. (Ex: Ant Migration Tool/ IDE)

Also, to publish/subscribe you need something similar to an APEX trigger, which can again be deployed/retrieved using Metadata API.

If you dont want to use the tools, you might want to develop a utility tool. I did not try it before but here are some details :

Krishna Avva

Julien NacciJulien Nacci

Hello Dilip,

I am also interested for the answer to this question. Have you found an "real" answer to your question ?

Hello Krishna:

The code example and the documentation is really poor for non Java developers. We do understand Platform Events are metadatas and can be created via MAtadata API, yet if you are not a Java developer the documentation and API reference is just useless as it does not show the HTTP request, verb and payload that is performed behind the hood by the Java SDK.

Is there a real API reference somewhere that actually describes the API and not only showcase the Java SDK ?

If not please provide the folowing for creating platform event:

  • http endpoint
  • http verb
  • http headers
  • query
  • payload

Thanks in advance for your help.

rajesh kuranarajesh kurana
hi Krishna.avva,
i have that doubt too, thnak you for the clarification,
GHDsports (
Deepali KulshresthaDeepali Kulshrestha
Hi Dilip,

The example assumes that the Low Ink platform event is defined in your Org. 
 Publish events by creating records of your event in the same way that you insert sObjects. 
 You can use any Salesforce API to create platform events, such as SOAP API, REST API, or Bulk API.

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha