Channel Lookup

To only retrieve channels by certain types, include them in a comma-separated list in the query parameter like so: channel_types=io.pnut.core.pm,com.example.site.

Endpoints:

GET /channels/{channel_id}

Scope: messages

Retrieve a channel object.

URL Parameters

Name Description
channel_id ID of the requested channel
Example
curl "https://api.pnut.io/v0/channels/5" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H "X-Pretty-Json: 1"

Returns the requested channel

{
    "meta": {
        "code": 200
    },
    "data": {"...Channel Object..."}
}

GET /channels

Scope: messages

Retrieve a list of specified channel objects. Only returns the first 200 found.

Query String Parameters

Name Description
ids Comma-separated list of channel IDs
Example
curl "https://api.pnut.io/v0/channels?ids=3,4,16" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H "X-Pretty-Json: 1"

Returns a list of channels

{
    "meta": {
        "code": 200
    },
    "data": [
        {"...Channel Object..."},
        {"...Channel Object..."},
        {"...Channel Object..."}
    ]
}

GET /users/me/channels

Token: user

Scope: messages

Retrieve a list of channels created by the authenticated user.

Example
curl "https://api.pnut.io/v0/users/me/channels" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H "X-Pretty-Json: 1"

Returns a list of channels

{
    "meta": {
        "more": false,
        "min_id": "0",
        "max_id": "0",
        "code": 200
    },
    "data": [
        {"...Channel Object..."}
    ]
}

GET /users/me/channels/existing_pm

Token: user

Scope: messages

Retrieve a Private Message channel for a set of users, if one exists.

Query String Parameters

Name Description
ids Comma-separated list of User IDs or @-usernames. The authenticated user can be included or excluded.
Example
curl "https://api.pnut.io/v0/users/me/channels/existing_pm?ids=2" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H "X-Pretty-Json: 1"

Returns a channel.

{
    "meta": {
        "code": 200
    },
    "data": {"....Channel Object..."}
}

GET /users/me/channels/num_unread/pm

Token: user

Scope: messages

Retrieve the number of unread private messages for the authenticated user.

Example
curl "https://api.pnut.io/v0/users/me/channels/num_unread/pm" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H "X-Pretty-Json: 1"

Returns the number of unread channels

{
    "meta": {
        "code": 200
    },
    "data": 0
}

DELETE /users/me/channels/num_unread/pm

Token: user

Scope: messages

Mark all unread private messages as read for the authenticated user.

Example
curl "https://api.pnut.io/v0/users/me/channels/num_unread/pm" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -X DELETE \
    -H "X-Pretty-Json: 1"

Returns the number of unread channels (0)

{
    "meta": {
        "code": 200
    },
    "data": 0
}