1. Home
  2. Docs
  3. REST API V2
  4. Email API
  5. Fetch Emails

Fetch Emails

You can retrieve list of all the emails from your Groundhogg by making GET HTTP request to your email endpoint.

http://yoursite.com/wp-json/gh/v2/emails?key=[public_key]&token=[token]

You can search for specific keyword and you can retrieve results which contains that keyword by passing search argument while making request.

http://yoursite.com/wp-json/gh/v2/emails?key=[public_key]&token=[token]&search=hello

Above request retrieve all the emails form email database which contains keyword “hello”  in tham.

You can also get specific email by passing email_id parameter. Following request retrieves email number 1 from list of emails. 

http://yoursite.com/wp-json/gh/v2/emails?key=[public_key]&token=[token]&email_id=1

Response for  the above request look like follows.

[{
	"email": {
		"ID": "1",
		"content": "<h1>HTML CONTENT OF YOUR EMAIL</h1>",
		"subject": "Email Preferences Changed",
		"pre_header": "",
		"from_user": "1",
		"author": "1",
		"status": "draft",
		"last_updated": "2018-12-17 09:28:08",
		"date_created": "2018-12-17 09:28:08"
	}
}]
Was this article helpful to you? Yes No

How can we help?