---
title: "Ask the homeserver to ping the application service to ensure the connection works."
method: POST
path: "/_matrix/client/v1/appservice/{appserviceId}/ping"
---

# Ask the homeserver to ping the application service to ensure the connection works.

`POST /_matrix/client/v1/appservice/{appserviceId}/ping`

## Request

- Base URL: `https://matrix.org`
- URL: `https://matrix.org/_matrix/client/v1/appservice/{appserviceId}/ping`
- Auth: one of:
  - API key in query parameter `access_token`
  - HTTP bearer
- TypeScript: <https://skmtc.dev/matrix/apis/matrix-client-server-api/docs/_matrix/client/v1/appservice/:appserviceId/ping/post.ts> (a function with typed inputs; its response is checked against the schema)

This API asks the homeserver to call the
[`/_matrix/app/v1/ping`](https://spec.matrix.org/v1.19/application-service-api/#post_matrixappv1ping) endpoint on the
application service to ensure that the homeserver can communicate
with the application service.

This API requires the use of an application service access token (`as_token`)
instead of a typical client's access token. This API cannot be invoked by
users who are not identified as application services. Additionally, the
appservice ID in the path must be the same as the appservice whose `as_token`
is being used.

## Path parameters

- `appserviceId` string, required

## Request body

- object
  - `transaction_id` string: An optional transaction ID that is passed through to the `/_matrix/app/v1/ping` call.

## Response `200`

The ping was successful.

- object
  - `duration_ms` integer, required: The duration in milliseconds that the [`/_matrix/app/v1/ping`](https://spec.matrix.org/v1.19/application-service-api/#post_matrixappv1ping) request took from the homeserver's point of view.

## Other responses

- `400`: The application service doesn't have a URL configured. The errcode is `M_URL_NOT_SET`.
- `403`: The access token used to authenticate the request doesn't belong to an appservice, or belongs to a different appservice than the one in the path. The errcode is `M_FORBIDDEN`.
- `502`: The application service returned a bad status, or the connection failed. The errcode is `M_BAD_STATUS` or `M_CONNECTION_FAILED`. For bad statuses, the response may include `status` and `body` fields containing the HTTP status code and response body text respectively to aid with debugging.
- `504`: The connection to the application service timed out. The errcode is `M_CONNECTION_TIMEOUT`.

---

[API](https://skmtc.dev/matrix/apis/matrix-client-server-api.md) - [All operations](https://skmtc.dev/matrix/apis/matrix-client-server-api/llms.txt) - [OpenAPI document](https://skmtc.dev/matrix/apis/matrix-client-server-api/revisions/c7fe4072c681?raw)
