Errors

Every error the API routes return is an application/problem+json document in the format of RFC 9457. Successful responses never use this format.

The error format

HTTP/1.1 400 Bad Request
Content-Type: application/problem+json
Request-Id: 7f0c2b1e-0000-0000-0000-000000000000
Cache-Control: no-store
{
  "type": "https://api.groupapp.co.il/docs/problems/invalid-request",
  "title": "Invalid request",
  "status": 400,
  "detail": "The body is not valid.",
  "instance": "/v1/posts",
  "code": "invalid-request",
  "requestId": "7f0c2b1e-0000-0000-0000-000000000000",
  "errors": [
    { "param": "targetIds", "message": "an array of 1-100 non-empty strings" }
  ]
}
Field Meaning
type A URL that points to the section of this page for the code.
title A short fixed title for the code.
status The HTTP status, the same as the response status.
detail A sentence about this occurrence. Do not parse it for logic; branch on code. A few details are stable machine strings, and they are named below.
instance The path of the request.
code The problem code. Branch on this.
requestId The same value as the Request-Id header.
errors Only on invalid-request: a list of {param, message}, one per invalid field (at most 20).

Headers

  • Request-Id: on every response, success or error. It identifies this HTTP call. Quote it to GroupApp support. It is not the req_ id of an asynchronous request (see Idempotency and async requests).
  • Retry-After: on rate-limited (seconds to wait), and on a request resource that is still open. See Rate limits.
  • WWW-Authenticate: Bearer: on every 401.
  • Cache-Control: no-store: on every response.

A method a route does not support (for example DELETE /v1/posts) answers a plain 405 Method Not Allowed without a problem body.

Your code should branch on code and status, and treat any code it does not know as an error of its status class.

invalid-request

Status 400. The request is malformed or breaks a rule. Nothing was done.

The API returns it when:

  • The body is not valid JSON (detail The body is not valid JSON.), is not a JSON object, or is larger than 256 KB (detail The body is too large.).
  • A field fails validation. The detail is The body is not valid. and errors[] lists each problem by param, for example an unknown field, botId missing, both or neither of targetIds and superGroupId, neither text nor mediaUrl, or a metadata value that is too long.
  • The Idempotency-Key header is empty, longer than 255 characters, or has characters other than printable ASCII without spaces.
  • wait is not a whole number from 0 to 10.
  • A target is not a group id, a channel id or status@broadcast, or is a reserved test id sent with a live key (the detail is person-target-refused). Posts never go to a person. Reserved test ids are accepted by test keys only (see Test mode).
  • On the list routes, GET /v1/bots/{botId} and GET /v1/super-groups/{superGroupId}, a query parameter is unknown or invalid (errors[] names it), a limit is outside 1 to 100, or a cursor is malformed, expired (cursors last one hour) or was made for different filters. GET /v1/posts/{postId} and GET /v1/requests/{requestId} ignore unknown query parameters.

What to do: fix the request using errors[]. Do not retry it unchanged.

missing-key

Status 401. The request has no Authorization: Bearer <key> header, or the token is empty.

What to do: send the key as Authorization: Bearer $GROUPAPP_API_KEY. See Authentication.

invalid-key

Status 401. The key is not accepted: it has the wrong shape or a bad checksum, no key like it exists, or its stored settings cannot be used.

What to do: check that the whole key was copied, with no spaces or line breaks, and that you are using the key and not its visible prefix. If the key is right, ask GroupApp for a new one.

revoked-key

Status 401. The key was revoked. A revoked key cannot be turned back on.

What to do: ask GroupApp for a new key. If you did not expect the revocation, find out why before you deploy a new key.

expired-key

Status 401. The key's expiry date has passed.

What to do: ask GroupApp for a new key, and deploy it before the next expiry.

forbidden

Status 403. The key is valid, but it may not do this.

The API returns it when:

  • The key does not have the scope the route needs (for example posts:write for POST /v1/posts, or posts:read for GET /v1/requests/{id}). The detail names what the key may not do, for example This key may not send posts.
  • The key's role does not allow the action. A viewer role cannot send posts.
  • The send is refused by a rule of the action.

On the public routes, a bot or object that is outside the key's bots is not forbidden. It is not-found. The first-party routes behave differently: an out-of-scope bot answers 403 there.

What to do: ask GroupApp to add the scope or use a key with a suitable role. Retrying does not help.

not-found

Status 404. The thing does not exist, or the key may not see it. The two cases are deliberately the same, so a key cannot find out about bots or requests that are not its own.

The API returns it when:

  • The path is not an API route, with any method (detail Not found, the same under /v1 and elsewhere on the API host). The key is not checked first, so this answer needs no Authorization header.
  • The bot is not one of the key's bots, or does not exist (Bot not found., or Not found. on POST /v1/posts and the list routes).
  • The post id is malformed, or the post is outside the key's reach (Post not found.).
  • The request id (req_...) is malformed, does not exist, belongs to another system, or is more than 30 days old (Request not found.).
  • A super group or group named in the call is outside the key's reach.

What to do: check the id and the key's bots. A request id works only with a key of the same system that created it.

conflict

Status 409. The request clashes with work already in progress. Nothing new was started.

The API returns it when:

  • The same Idempotency-Key is still being processed (detail idempotency-key-in-flight: req_..., the id of the first request). The first call started less than a minute ago and has not been accepted yet.
  • An identical send (same targets and content) from the same key is already in progress (detail already-in-progress: req_...). Without an Idempotency-Key the API refuses the duplicate. A call with an Idempotency-Key is not refused for this reason, except a send to status@broadcast: the key does not skip the duplicate check there, so an identical Status send in progress answers 409 already-in-progress: req_... and the Idempotency-Key is released.
  • A call with an Idempotency-Key collides with the call that already holds the key's request: for example, your retry took over a stalled first call, and both tried to start the same request (detail already-in-progress: req_..., the id of that request). Nothing new is sent, and the Idempotency-Key stays used.

What to do: read the request named in the detail with GET /v1/requests/{id} and wait for it to finish, then retry if needed. With an Idempotency-Key, retrying the same call after a few seconds returns the original answer once it is stored, and does not send twice. See Idempotency and async requests.

gone

Status 410. The bot existed and is not available any more. Retrying will not change it.

The API returns it when:

  • The bot was retired (This bot was retired.).
  • mediaUrl of a post is a file uploaded to GroupApp that has expired (detail media-expired).

What to do: for a retired bot, stop calling it and remove it from your configuration. For media-expired, upload the file again and send the new link.

unprocessable

Status 422. The request is well formed, but it cannot be processed in this state.

Today the API returns it for one reason: the Idempotency-Key was already used with a different method, route or body (detail idempotency-key-reused). The first request is not touched.

What to do: use a new Idempotency-Key for a new request. Send the same key only with the same body.

rate-limited

Status 429. The key, or the system the key belongs to, used up a limit. The call was not started.

The Retry-After header holds the number of whole seconds to wait. The detail names the bucket: read rate limit exceeded, command rate limit exceeded or send rate limit exceeded.

What to do: wait Retry-After seconds and retry. Spread calls out, and do not retry in a tight loop. See Rate limits.

internal

Status 500. An unexpected error on GroupApp's side. The detail is always Internal error; no internal text is returned.

What to do: retry after a short delay. For a POST /v1/posts call, retry with the same Idempotency-Key, so a send that did go out is not repeated. If it keeps failing, send the requestId to GroupApp support.

unavailable

Status 503. A service the call depends on is temporarily not available.

The routes built today do not normally return this code; it is part of the contract for a temporary outage, so handle it.

What to do: retry after a delay that grows each time. For a POST /v1/posts, retry with the same Idempotency-Key.