— API, PeachKit & Peach for Mac — API, PeachKit & Peach for Mac

So Peach stumbled onto the scene Friday. If you haven't heard of it, it's this cool new social network that lets you post cool stuff using "magic" words.

Currently it's only available on iOS which, while great means that I can't really check it while I'm in work. I did some sniffing by routing my iPhone through Charles to see if I could find out how the thing interacts and if there's an API I could latch onto to build a Mac app.

It turns out there totally is.

Peach's API

The API is completely there and totally, publicly accessible at the following URL:

There are some things to note when interacting with the API:

  • All data is encoded and sent as JSON and not form data.
  • Authentication is done as a kind of X-Auth thing (I think). You authenticate with username and password and you'll receive a token back that you can use as the "Bearer" in the authentication header.
  • Magic words aren't handled by the API but are instead triggered via the app. This means that if you want to search Giphy you'll need to add that support yourself and interact with their API directly.
  • The little questions that come up when you click the lightbulb in the new post section are just a JSON file included in the app and not handled by the API. They're officially called "jolts".
  • Posts are made up of an array of messages. Each message has a type and in some cases a subtype.


I've started mapping the API out and here's what I've got so far:

Endpoint Method Parameters Description
/login POST email, password Authenticate user. Returns a stream ID and bearer token that should be stored for later interaction with the API.
/stream/activity GET Get the activity feed. This is notifications like "@ste liked your post".
/connections GET This is actually the main screen on the iOS app. It's a list of streams complete with all of the posts relating to the stream.
/stream/id/:id GET Replace :id with the id of the stream you wish to retrieve. This will return a single stream in the same format as the connections endpoint.
/post POST message — this is an array of messages related to the post. Create a new post on Peach.

While the above is not complete, I'll be updating it as I map out more of the API. I'm aware of some endpoints such as single post, liking/commenting on posts and marking posts as read that are not included here.

PeachKit for Swift

In order to make use of the the API I've built a little framework for Swift that provides some nice little helper methods for interacting with the API. It's far from complete but I've open-sourced it on GitHub if you'd like to take a look.

View PeachKit on GitHub


I won't list all of the methods here but just some quick example of how to use the library.


User.authenticateWithCredentials((email: "", password: "secretpassword123")) { result, error in
    if let info = result {
        Peach.OAuthToken = info.token
        Peach.streamID = info.streamID

The token returned must be stored for future use.


Peach.getStreams { streams, error in
    self.streams = streams

You can also use the getConnections alias to achieve the same thing.

Create Post

var msg = Message()
msg.text = "Hello World"

Peach.createPost([Message]) { error in

Currently only text posts with a single message can be created but this is likely to change pretty rapidly as I develop PeachKit.

Peach For Mac

All of this was created for that Mac client I mentioned. I've been working on it over the last few evenings. It's far from completed but I wanted to open source it now in case anyone is brave enough to try or help develop it.

View Peach For Mac on Github

Any feedback on all of this is appreciated! Leave a comment, Github issue or ping me @steve228uk or on Peach I'm @ste and also check out @retrografix