{
    "definitions": {
        "channel": {
            "$schema": "http://json-schema.org/draft-04/schema",
            "definitions": {
                "channel_id": {
                    "description": "unique identifier of channel",
                    "example": 123456,
                    "type": [
                        "integer"
                    ]
                },
                "drains": {
                    "description": "drains under the channel",
                    "items": {
                        "$ref": "#/definitions/drain"
                    },
                    "type": [
                        "array"
                    ]
                },
                "identity": {
                    "$ref": "#/definitions/channel/definitions/channel_id"
                },
                "tokens": {
                    "description": "tokens under the channel",
                    "items": {
                        "$ref": "#/definitions/token"
                    },
                    "type": [
                        "array"
                    ]
                }
            },
            "description": "A channel is a log stream.",
            "links": [
                {
                    "description": "Create a new channel.",
                    "href": "/channels",
                    "method": "POST",
                    "rel": "create",
                    "schema": {
                        "properties": {
                            "name": {
                                "description": "a name for the channel",
                                "example": "my-channel",
                                "type": [
                                    "string"
                                ]
                            },
                            "tokens": {
                                "description": "names of tokens to create",
                                "example": [
                                    "my-token",
                                    "your-token"
                                ],
                                "items": {
                                    "type": [
                                        "string"
                                    ]
                                },
                                "type": [
                                    "array"
                                ]
                            }
                        },
                        "required": [
                            "name"
                        ],
                        "type": [
                            "object"
                        ]
                    },
                    "targetSchema": {
                        "properties": {
                            "channel_id": {
                                "$ref": "#/definitions/channel/definitions/channel_id"
                            },
                            "tokens": {
                                "description": "created token names and tokens",
                                "example": {
                                    "my-token": "t.01234567-89ab-cdef-0123-456789abcdef",
                                    "your-token": "t.5b432a82-2c03-4ecd-a8d4-a75d627b29ab"
                                },
                                "type": [
                                    "object"
                                ]
                            }
                        },
                        "type": [
                            "object"
                        ]
                    },
                    "title": "Create"
                },
                {
                    "description": "Delete an existing channel.",
                    "href": "/v2/channels/{(%23%2Fdefinitions%2Fchannel%2Fdefinitions%2Fidentity)}",
                    "method": "DELETE",
                    "rel": "empty",
                    "response_example": {
                        "head": "HTTP/1.1 200 OK"
                    },
                    "title": "Delete",
                    "type": [
                        null
                    ]
                },
                {
                    "description": "Info for existing channel.",
                    "href": "/v2/channels/{(%23%2Fdefinitions%2Fchannel%2Fdefinitions%2Fidentity)}",
                    "method": "GET",
                    "rel": "self",
                    "title": "Info",
                    "type": [
                        "object"
                    ]
                }
            ],
            "properties": {
                "channel_id": {
                    "$ref": "#/definitions/channel/definitions/channel_id"
                },
                "drains": {
                    "$ref": "#/definitions/channel/definitions/drains"
                },
                "tokens": {
                    "$ref": "#/definitions/channel/definitions/tokens"
                }
            },
            "title": "Channel",
            "type": [
                "object"
            ]
        },
        "drain": {
            "$schema": "http://json-schema.org/draft-04/schema",
            "definitions": {
                "id": {
                    "description": "unique identifier of drain",
                    "example": 123456,
                    "type": [
                        "integer"
                    ]
                },
                "identity": {
                    "$ref": "#/definitions/drain/definitions/id"
                },
                "token": {
                    "description": "drain token",
                    "example": "d.01234567-89ab-cdef-0123-456789abcdef",
                    "type": [
                        "string"
                    ]
                },
                "url": {
                    "description": "drain destination",
                    "example": "https://example.org",
                    "type": [
                        "string"
                    ]
                }
            },
            "description": "Drains are log stream tee targets.",
            "links": [
                {
                    "description": "Create a new drain.",
                    "href": "/v2/channels/{(%23%2Fdefinitions%2Fchannel%2Fdefinitions%2Fidentity)}/drains",
                    "method": "POST",
                    "rel": "create",
                    "schema": {
                        "properties": {
                            "url": {
                                "$ref": "#/definitions/drain/definitions/url"
                            }
                        },
                        "required": [
                            "url"
                        ],
                        "type": [
                            "object"
                        ]
                    },
                    "title": "Create"
                },
                {
                    "description": "Delete an existing drain.",
                    "href": "/v2/channels/{(%23%2Fdefinitions%2Fchannel%2Fdefinitions%2Fidentity)}/drains/{(%23%2Fdefinitions%2Fdrain%2Fdefinitions%2Fidentity)}",
                    "method": "DELETE",
                    "rel": "empty",
                    "response_example": {
                        "head": "HTTP/1.1 200 OK"
                    },
                    "title": "Delete",
                    "type": [
                        null
                    ]
                },
                {
                    "description": "Update an existing drain.",
                    "href": "/v2/channels/{(%23%2Fdefinitions%2Fchannel%2Fdefinitions%2Fidentity)}/drains/{(%23%2Fdefinitions%2Fdrain%2Fdefinitions%2Fidentity)}",
                    "method": "POST",
                    "rel": "update",
                    "schema": {
                        "properties": {
                            "url": {
                                "$ref": "#/definitions/drain/definitions/url"
                            }
                        },
                        "required": [
                            "url"
                        ],
                        "type": [
                            "object"
                        ]
                    },
                    "title": "Update"
                }
            ],
            "properties": {
                "id": {
                    "$ref": "#/definitions/drain/definitions/id"
                },
                "token": {
                    "$ref": "#/definitions/drain/definitions/token"
                },
                "url": {
                    "$ref": "#/definitions/drain/definitions/url"
                }
            },
            "title": "Drain",
            "type": [
                "object"
            ]
        },
        "health": {
            "$schema": "http://json-schema.org/draft-04/schema",
            "definitions": {
                "status": {
                    "description": "API control rod status (normal, read_only)",
                    "example": "normal",
                    "type": [
                        "string"
                    ]
                }
            },
            "links": [
                {
                    "description": "Performs a health check against the API.",
                    "href": "/healthcheck",
                    "method": "GET",
                    "rel": "self",
                    "targetSchema": {
                        "properties": {
                            "status": {
                                "$ref": "#/definitions/health/definitions/status"
                            }
                        },
                        "type": [
                            "object"
                        ]
                    }
                }
            ],
            "title": "Healthchecks"
        },
        "session": {
            "$schema": "http://json-schema.org/draft-04/schema",
            "definitions": {
                "identity": {
                    "$ref": "#/definitions/session/definitions/session_id"
                },
                "session_id": {
                    "description": "unique identifier of a session",
                    "example": "d58fb90e-c2bd-4e16-bfe0-e9e7cc7bff7f",
                    "type": [
                        "string"
                    ]
                },
                "url": {
                    "description": "session URL to GET to retrieve logs",
                    "example": "https://logplex.heroku.com/sessions/d58fb90e-c2bd-4e16-bfe0-e9e7cc7bff7f",
                    "type": [
                        "string"
                    ]
                }
            },
            "description": "Sessions fetch recent and real-time logs from channels.",
            "links": [
                {
                    "description": "Create a new session.",
                    "href": "/v2/sessions",
                    "method": "POST",
                    "rel": "create",
                    "schema": {
                        "example": {
                            "channel_id": "12345",
                            "num": "5"
                        },
                        "properties": {
                            "channel_id": {
                                "description": "unique identifier of channel (must be a string)",
                                "example": "12345",
                                "type": [
                                    "string"
                                ]
                            },
                            "num": {
                                "default": "100",
                                "description": "number of log lines to fetch",
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "tail": {
                                "description": "if present with any value, start a live tail session",
                                "type": [
                                    "boolean",
                                    "null"
                                ]
                            }
                        },
                        "required": [
                            "channel_id"
                        ],
                        "type": [
                            "object"
                        ]
                    },
                    "title": "Create",
                    "type": [
                        "object"
                    ]
                },
                {
                    "description": "Get the chunk encoded session log data. If tail was specified the connection is long lived.",
                    "href": "/sessions/{(%23%2Fdefinitions%2Fsession%2Fdefinitions%2Fidentity)}",
                    "method": "GET",
                    "rel": "empty",
                    "response_example": {
                        "body": "2012-12-10T03:00:48Z+00:00 app[console.1]: test message 1\n2012-12-10T03:00:49Z+00:00 app[console.1]: test message 2\n2012-12-10T03:00:50Z+00:00 app[console.1]: test message 3\n2012-12-10T03:00:51Z+00:00 app[console.1]: test message 4\n2012-12-10T03:00:52Z+00:00 app[console.1]: test message 5\n",
                        "head": "HTTP/1.1 200 OK\nTransfer-Encoding: chunked\n"
                    },
                    "title": "Logs",
                    "type": [
                        null,
                        "string"
                    ]
                }
            ],
            "properties": {
                "url": {
                    "$ref": "#/definitions/session/definitions/url"
                }
            },
            "title": "Session",
            "type": [
                "object"
            ]
        },
        "token": {
            "$schema": "http://json-schema.org/draft-04/schema",
            "definitions": {
                "identity": {
                    "$ref": "#/definitions/token/definitions/token"
                },
                "name": {
                    "description": "name of token",
                    "example": "my-token",
                    "type": [
                        "string"
                    ]
                },
                "token": {
                    "description": "unique identifier of token",
                    "example": "t.01234567-89ab-cdef-0123-456789abcdef",
                    "type": [
                        "string"
                    ]
                }
            },
            "description": "Tokens are log producers.",
            "links": [
                {
                    "description": "Create a new token.",
                    "href": "/v2/channels/{(%23%2Fdefinitions%2Fchannel%2Fdefinitions%2Fidentity)}/tokens",
                    "method": "POST",
                    "rel": "create",
                    "schema": {
                        "properties": {
                            "name": {
                                "$ref": "#/definitions/token/definitions/name"
                            }
                        },
                        "required": [
                            "name"
                        ],
                        "type": [
                            "object"
                        ]
                    },
                    "title": "Create"
                }
            ],
            "properties": {
                "name": {
                    "$ref": "#/definitions/token/definitions/name"
                },
                "token": {
                    "$ref": "#/definitions/token/definitions/token"
                }
            },
            "title": "Token",
            "type": [
                "object"
            ]
        }
    },
    "description": "The log router",
    "links": [
        {
            "href": "https://logplex.heroku.com",
            "rel": "self"
        }
    ],
    "properties": {
        "channel": {
            "$ref": "#/definitions/channel"
        },
        "drain": {
            "$ref": "#/definitions/drain"
        },
        "health": {
            "$ref": "#/definitions/health"
        },
        "session": {
            "$ref": "#/definitions/session"
        },
        "token": {
            "$ref": "#/definitions/token"
        }
    },
    "title": "Logplex",
    "type": [
        "object"
    ]
}