{
  "openapi": "3.1.0",
  "info": {
    "title": "NudgeNudge API",
    "version": "1.4.1",
    "summary": "Send a push to your own iPhone with one HTTPS request.",
    "description": "The contract is the docs page, https://nudgenudge.app/docs/; this spec says the same in a form tools can read. Every error has a stable `reason` (for code) and an `error` sentence (for people). HTTPS only. There is no auth header: the code (or a send key) in the path is the credential, so treat it like a password.",
    "contact": {
      "email": "support@nudgenudge.app",
      "url": "https://nudgenudge.app/docs/"
    },
    "termsOfService": "https://nudgenudge.app/terms/"
  },
  "servers": [
    {
      "url": "https://api.nudgenudge.app"
    }
  ],
  "externalDocs": {
    "url": "https://nudgenudge.app/docs/"
  },
  "paths": {
    "/{code}": {
      "parameters": [
        {
          "name": "code",
          "in": "path",
          "required": true,
          "description": "A phone's code (12 characters, e.g. D4RY-YY78-PNRS), a group's (9, e.g. PN3-U6X-MD2), or a send key (nk_\u2026). Dashes and case don't matter.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "operationId": "send",
        "summary": "Push or Ask",
        "description": "JSON is recommended. A plain-text body, form fields and headers work too; field names are the same everywhere. An Ask holds the request open until it's answered (up to ~90 s), then replies 202 with a ticket.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Up to 200 characters, unique per nudge: a retry with the same key gets the first reply again instead of a second notification. Kept a day.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "From",
            "in": "header",
            "required": false,
            "description": "Sender name.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Icon",
            "in": "header",
            "required": false,
            "description": "Logo: a domain or an https:// image URL.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Title",
            "in": "header",
            "required": false,
            "description": "Bold first line.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Url",
            "in": "header",
            "required": false,
            "description": "An https:// link shown under the nudge.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Level",
            "in": "header",
            "required": false,
            "description": "passive | normal | time-sensitive | critical.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Ask",
            "in": "header",
            "required": false,
            "description": "Makes it an Ask: buttons, comma-separated (up to 4). Empty or \"true\" for Yes, No.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Reply",
            "in": "header",
            "required": false,
            "description": "\"true\": the Ask takes a typed answer.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Wait",
            "in": "header",
            "required": false,
            "description": "Seconds the Ask stays open (default 600, up to 86400).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Nudge"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/Nudge"
              }
            },
            "text/plain": {
              "schema": {
                "type": "string",
                "description": "The message (fields as headers)."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Delivered (a Push), or answered (an Ask, within ~90 s).",
            "headers": {
              "RateLimit-Limit": {
                "description": "Today's allowance: 5, or 1000 (the flood guard) on Unlimited. Phone codes only.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "What's left today after this one. Phone codes only.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until midnight UTC, when the allowance resets. Phone codes only.",
                "schema": {
                  "type": "integer"
                }
              },
              "Idempotent-Replayed": {
                "description": "\"true\" when this is the kept reply to an earlier request with the same Idempotency-Key.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/PushReply"
                    },
                    {
                      "$ref": "#/components/schemas/GroupReply"
                    },
                    {
                      "$ref": "#/components/schemas/AskAnswered"
                    }
                  ]
                }
              }
            }
          },
          "202": {
            "description": "An Ask delivered and still waiting: collect the answer at GET /ask/{id}.",
            "headers": {
              "RateLimit-Limit": {
                "description": "Today's allowance: 5, or 1000 (the flood guard) on Unlimited. Phone codes only.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "What's left today after this one. Phone codes only.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until midnight UTC, when the allowance resets. Phone codes only.",
                "schema": {
                  "type": "integer"
                }
              },
              "Idempotent-Replayed": {
                "description": "\"true\" when this is the kept reply to an earlier request with the same Idempotency-Key.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AskWaiting"
                }
              }
            }
          },
          "400": {
            "description": "bad_request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "not_a_code, unknown_code or unknown_key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "notifications_off or in_progress",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "expired (an Ask nobody answered), phone_gone or no_phones",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "too_big",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "426": {
            "description": "https_required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "daily_limit, flood_guard, rate_limited or too_many_wrong",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "RateLimit-Limit": {
                "description": "Today's allowance: 5, or 1000 (the flood guard) on Unlimited. Phone codes only.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "What's left today after this one. Phone codes only.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until midnight UTC, when the allowance resets. Phone codes only.",
                "schema": {
                  "type": "integer"
                }
              },
              "Idempotent-Replayed": {
                "description": "\"true\" when this is the kept reply to an earlier request with the same Idempotency-Key.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "502": {
            "description": "push_failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "server_error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "sendByUrl",
        "summary": "Push or Ask from a URL",
        "description": "For tools that can only open a URL: the fields as query parameters (body, m or message; from; icon; title; url; level; ask; reply; wait). With no parameters, redirects to the docs.",
        "parameters": [
          {
            "name": "body",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ask",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Delivered (a Push), or answered (an Ask, within ~90 s).",
            "headers": {
              "RateLimit-Limit": {
                "description": "Today's allowance: 5, or 1000 (the flood guard) on Unlimited. Phone codes only.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "What's left today after this one. Phone codes only.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until midnight UTC, when the allowance resets. Phone codes only.",
                "schema": {
                  "type": "integer"
                }
              },
              "Idempotent-Replayed": {
                "description": "\"true\" when this is the kept reply to an earlier request with the same Idempotency-Key.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/PushReply"
                    },
                    {
                      "$ref": "#/components/schemas/GroupReply"
                    },
                    {
                      "$ref": "#/components/schemas/AskAnswered"
                    }
                  ]
                }
              }
            }
          },
          "202": {
            "description": "An Ask delivered and still waiting: collect the answer at GET /ask/{id}.",
            "headers": {
              "RateLimit-Limit": {
                "description": "Today's allowance: 5, or 1000 (the flood guard) on Unlimited. Phone codes only.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "What's left today after this one. Phone codes only.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until midnight UTC, when the allowance resets. Phone codes only.",
                "schema": {
                  "type": "integer"
                }
              },
              "Idempotent-Replayed": {
                "description": "\"true\" when this is the kept reply to an earlier request with the same Idempotency-Key.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AskWaiting"
                }
              }
            }
          },
          "400": {
            "description": "bad_request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "not_a_code, unknown_code or unknown_key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "expired (an Ask nobody answered), phone_gone or no_phones",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "too_big",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "426": {
            "description": "https_required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "daily_limit, flood_guard, rate_limited or too_many_wrong",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "RateLimit-Limit": {
                "description": "Today's allowance: 5, or 1000 (the flood guard) on Unlimited. Phone codes only.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "What's left today after this one. Phone codes only.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until midnight UTC, when the allowance resets. Phone codes only.",
                "schema": {
                  "type": "integer"
                }
              },
              "Idempotent-Replayed": {
                "description": "\"true\" when this is the kept reply to an earlier request with the same Idempotency-Key.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "502": {
            "description": "push_failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "server_error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "302": {
            "description": "No parameters: the docs."
          }
        }
      }
    },
    "/ask/{id}": {
      "get": {
        "operationId": "collect",
        "summary": "Collect an Ask's answer",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "wait",
            "in": "query",
            "description": "Seconds to wait for it (0 to 90, default 60).",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 90
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The answer. Collected: the ticket is gone.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AskAnswered"
                }
              }
            }
          },
          "202": {
            "description": "Still waiting.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AskWaiting"
                }
              }
            }
          },
          "404": {
            "description": "unknown_ask",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "expired",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/2fa/{code}": {
      "parameters": [
        {
          "name": "code",
          "in": "path",
          "required": true,
          "description": "A phone's code (12 characters) or a send key for one. A group's is refused.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "operationId": "twoFactor",
        "summary": "NudgeNudge 2FA: a sign-in approved on the phone",
        "description": "Waits until the person taps a number, or 60 seconds. Free; no daily limit beyond the 1,000-a-day flood guard.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignIn"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The outcome.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignInResult"
                }
              }
            }
          },
          "400": {
            "description": "bad_request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "not_a_code, unknown_code or unknown_key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "notifications_off",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "phone_gone",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "paused (after a wrong answer or Not me; `until`) or flood_guard.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "push_failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/{code}/keys": {
      "parameters": [
        {
          "name": "code",
          "in": "path",
          "required": true,
          "description": "A phone's or a group's code (not a send key: only the code manages keys).",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "operationId": "listKeys",
        "summary": "List send keys",
        "responses": {
          "200": {
            "description": "The keys, never the key itself.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "keys": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/KeyListed"
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_a_code or unknown_code",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "makeKey",
        "summary": "Make a send key",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 40
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The key, shown this once.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyMade"
                }
              }
            }
          },
          "404": {
            "description": "not_a_code or unknown_code",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "too_many_keys",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/{code}/keys/{id}": {
      "parameters": [
        {
          "name": "code",
          "in": "path",
          "required": true,
          "description": "A phone's or a group's code (not a send key: only the code manages keys).",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "delete": {
        "operationId": "revokeKey",
        "summary": "Revoke a send key",
        "responses": {
          "200": {
            "description": "Revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ok"
                }
              }
            }
          },
          "404": {
            "description": "unknown_code or unknown_key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/icon/{domain}": {
      "get": {
        "operationId": "icon",
        "summary": "A site's logo, as nudges use it",
        "parameters": [
          {
            "name": "domain",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "github.com"
          }
        ],
        "responses": {
          "200": {
            "description": "The image.",
            "content": {
              "image/*": {}
            }
          },
          "400": {
            "description": "Not a domain."
          },
          "404": {
            "description": "No icon found."
          }
        }
      }
    },
    "/receipt/{id}": {
      "get": {
        "operationId": "receipt",
        "summary": "Did it reach the phone?",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "wait",
            "in": "query",
            "description": "Seconds to wait for every phone (0 to 30).",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 30
            }
          }
        ],
        "responses": {
          "200": {
            "description": "How many phones confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Receipt"
                }
              }
            }
          },
          "404": {
            "description": "unknown_receipt",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Nudge": {
        "type": "object",
        "required": [
          "body"
        ],
        "properties": {
          "body": {
            "type": "string",
            "description": "The message. Aliases: message, m, text."
          },
          "from": {
            "type": "string",
            "description": "Sender name (names starting NudgeNudge are reserved). Aliases: source, app."
          },
          "icon": {
            "type": "string",
            "description": "A domain or an https:// image. Remembered per sender. Alias: logo."
          },
          "title": {
            "type": "string",
            "description": "Alias: subject."
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "An https:// link. Alias: link."
          },
          "level": {
            "type": "string",
            "enum": [
              "passive",
              "normal",
              "time-sensitive",
              "critical"
            ],
            "description": "Alias: priority (not as a header)."
          },
          "ask": {
            "oneOf": [
              {
                "type": "array",
                "items": {
                  "type": "string",
                  "maxLength": 30
                },
                "maxItems": 4
              },
              {
                "type": "boolean"
              }
            ],
            "description": "Makes it an Ask: its buttons (true: Yes, No)."
          },
          "reply": {
            "type": "boolean",
            "description": "The Ask takes a typed answer."
          },
          "wait": {
            "type": "integer",
            "minimum": 1,
            "maximum": 86400,
            "description": "Seconds the Ask stays open (default 600)."
          }
        }
      },
      "PushReply": {
        "type": "object",
        "properties": {
          "ok": {
            "const": true
          },
          "left": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Free nudges left today; null on Unlimited."
          },
          "receipt": {
            "type": "string",
            "description": "The push's delivery receipt: GET /receipt/{id}."
          }
        }
      },
      "GroupReply": {
        "type": "object",
        "properties": {
          "ok": {
            "const": true
          },
          "phones": {
            "type": "integer"
          },
          "over": {
            "type": "integer"
          },
          "flooded": {
            "type": "integer"
          },
          "off": {
            "type": "integer"
          },
          "receipt": {
            "type": "string",
            "description": "The push's delivery receipt: GET /receipt/{id}."
          }
        }
      },
      "AskAnswered": {
        "type": "object",
        "properties": {
          "ok": {
            "const": true
          },
          "ask": {
            "type": "string"
          },
          "answer": {
            "type": "string"
          },
          "left": {
            "type": [
              "integer",
              "null"
            ]
          },
          "phones": {
            "type": "integer"
          },
          "receipt": {
            "type": "string",
            "description": "The push's delivery receipt: GET /receipt/{id}."
          }
        }
      },
      "AskWaiting": {
        "type": "object",
        "properties": {
          "ok": {
            "const": true
          },
          "ask": {
            "type": "string"
          },
          "waiting": {
            "const": true
          },
          "expires": {
            "type": "integer",
            "description": "Milliseconds since 1970."
          },
          "receipt": {
            "type": "string",
            "description": "The push's delivery receipt: GET /receipt/{id}."
          }
        }
      },
      "SignIn": {
        "type": "object",
        "required": [
          "site",
          "number"
        ],
        "properties": {
          "site": {
            "type": "string",
            "maxLength": 30
          },
          "number": {
            "type": "integer",
            "minimum": 10,
            "maximum": 99
          },
          "where": {
            "type": "string",
            "maxLength": 40
          },
          "icon": {
            "type": "string"
          }
        }
      },
      "SignInResult": {
        "type": "object",
        "properties": {
          "approved": {
            "type": "boolean"
          },
          "reason": {
            "type": "string",
            "enum": [
              "wrong_number",
              "denied",
              "expired"
            ]
          },
          "denied": {
            "type": "boolean"
          },
          "paused_until": {
            "type": "integer"
          },
          "delivered": {
            "type": "boolean",
            "description": "On an expired sign-in: whether it reached the phone."
          }
        }
      },
      "KeyMade": {
        "type": "object",
        "properties": {
          "ok": {
            "const": true
          },
          "key": {
            "type": "string",
            "pattern": "^nk_[23456789a-hjkmnp-z]{24}$"
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        }
      },
      "KeyListed": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "created": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Ok": {
        "type": "object",
        "properties": {
          "ok": {
            "const": true
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "reason",
          "error"
        ],
        "properties": {
          "reason": {
            "type": "string",
            "enum": [
              "bad_request",
              "not_a_code",
              "unknown_code",
              "unknown_key",
              "unknown_ask",
              "notifications_off",
              "in_progress",
              "too_many_keys",
              "expired",
              "phone_gone",
              "no_phones",
              "too_big",
              "https_required",
              "daily_limit",
              "flood_guard",
              "paused",
              "rate_limited",
              "too_many_wrong",
              "push_failed",
              "server_error",
              "not_found",
              "unknown_receipt"
            ],
            "description": "Stable: never renamed."
          },
          "error": {
            "type": "string",
            "description": "A sentence, for people."
          }
        }
      },
      "Receipt": {
        "type": "object",
        "properties": {
          "ok": {
            "const": true
          },
          "receipt": {
            "type": "string"
          },
          "phones": {
            "type": "integer"
          },
          "delivered": {
            "type": "integer",
            "description": "Phones that confirmed it arrived (apps 1.4.1 and later)."
          },
          "at": {
            "type": "integer",
            "description": "The first confirmation, ms since 1970."
          }
        }
      }
    }
  },
  "security": []
}
