Skip to content

API reference

Webhooks

Subscribe a project to lifecycle events. Verify delivery signatures and deduplicate event IDs in your receiver.

How it fits together

  1. 01Subscribe a destination to a project's events. Returns the signing secret once
  2. 02Queue a finished delivery to be attempted again. The attempt history is preserved
  3. 03Issue a new signing secret, keeping the old one for a bounded overlap. Returns it once

Select an action to see its complete inputs, request, response, and status codes.

Subscribe a destination to a project's events. Returns the signing secret once

POST/api/v1/chat/projects/{project_id}/webhooks
Production base URLhttps://api.mahvashai.ir
AuthenticationUser access JWT
ResponseMahvash product envelope
Content typeapplication/json

Parameters

The table shows the accepted inputs for this endpoint. Examples use placeholders and illustrate a safe integration pattern.

NameLocationTypeRequiredSupportDetails
project_idPathstringRequiredMahvash extensionProject ID.
X-Request-IDHeaderstringOptionalMahvash extensionClient-supplied correlation ID. Echoed on every response; replaced when absent or malformed.
X-Mahvash-ProjectHeaderstringOptionalMahvash extensionProject slug or ID within the caller's organization. Narrows the request principal; it can never widen it.
event_typesBodyarray<value>RequiredMahvash extensionEvent types to receive. An unknown type is refused, never dropped.
urlBodystringRequiredMahvash extensionHTTPS destination. Validated against network policy here and again before every delivery.

Request

curl -X POST 'https://api.mahvashai.ir/api/v1/chat/projects/<project_id>/webhooks' \
  -H "Authorization: Bearer $MAHVASH_USER_JWT" \
  -H "Content-Type: application/json" \
  -d '{
  "event_types": [
    "response.completed"
  ],
  "url": "https://hooks.example.com/mahvash"
}'

Response

{
  "status": 0,
  "data": "<value>"
}

Illustrative response shape; actual fields depend on the operation and model.

Status codes

HTTPDetails
201Subscribe a destination to a project's events. Returns the signing secret once.
400The request is not valid.
401Authentication credentials are missing or invalid.
403The principal is not allowed to perform this request.
404No such resource is visible to this principal.
429A quota or rate limit was exceeded.
500An internal error occurred.

Queue a finished delivery to be attempted again. The attempt history is preserved

POST/api/v1/chat/webhook-deliveries/{delivery_id}/replay
Production base URLhttps://api.mahvashai.ir
AuthenticationUser access JWT
ResponseMahvash product envelope

Parameters

The table shows the accepted inputs for this endpoint. Examples use placeholders and illustrate a safe integration pattern.

NameLocationTypeRequiredSupportDetails
delivery_idPathstringRequiredMahvash extensionDelivery ID.
X-Request-IDHeaderstringOptionalMahvash extensionClient-supplied correlation ID. Echoed on every response; replaced when absent or malformed.
X-Mahvash-ProjectHeaderstringOptionalMahvash extensionProject slug or ID within the caller's organization. Narrows the request principal; it can never widen it.

Request

curl -X POST 'https://api.mahvashai.ir/api/v1/chat/webhook-deliveries/<delivery_id>/replay' \
  -H "Authorization: Bearer $MAHVASH_USER_JWT"

Response

{
  "status": 0,
  "data": "<value>"
}

Illustrative response shape; actual fields depend on the operation and model.

Status codes

HTTPDetails
200Queue a finished delivery to be attempted again. The attempt history is preserved.
400The request is not valid.
401Authentication credentials are missing or invalid.
403The principal is not allowed to perform this request.
404No such resource is visible to this principal.
429A quota or rate limit was exceeded.
500An internal error occurred.

Issue a new signing secret, keeping the old one for a bounded overlap. Returns it once

POST/api/v1/chat/webhooks/{endpoint_id}/rotate
Production base URLhttps://api.mahvashai.ir
AuthenticationUser access JWT
ResponseMahvash product envelope

Parameters

The table shows the accepted inputs for this endpoint. Examples use placeholders and illustrate a safe integration pattern.

NameLocationTypeRequiredSupportDetails
endpoint_idPathstringRequiredMahvash extensionWebhook subscription ID.
X-Request-IDHeaderstringOptionalMahvash extensionClient-supplied correlation ID. Echoed on every response; replaced when absent or malformed.
X-Mahvash-ProjectHeaderstringOptionalMahvash extensionProject slug or ID within the caller's organization. Narrows the request principal; it can never widen it.

Request

curl -X POST 'https://api.mahvashai.ir/api/v1/chat/webhooks/<endpoint_id>/rotate' \
  -H "Authorization: Bearer $MAHVASH_USER_JWT"

Response

{
  "status": 0,
  "data": "<value>"
}

Illustrative response shape; actual fields depend on the operation and model.

Status codes

HTTPDetails
201Issue a new signing secret, keeping the old one for a bounded overlap. Returns it once.
401Authentication credentials are missing or invalid.
403The principal is not allowed to perform this request.
404No such resource is visible to this principal.
429A quota or rate limit was exceeded.
500An internal error occurred.

One webhook subscription and its delivery health

GET/api/v1/chat/webhooks/{endpoint_id}
Production base URLhttps://api.mahvashai.ir
AuthenticationUser access JWT
ResponseMahvash product envelope

Parameters

The table shows the accepted inputs for this endpoint. Examples use placeholders and illustrate a safe integration pattern.

NameLocationTypeRequiredSupportDetails
endpoint_idPathstringRequiredMahvash extensionWebhook subscription ID.
X-Request-IDHeaderstringOptionalMahvash extensionClient-supplied correlation ID. Echoed on every response; replaced when absent or malformed.
X-Mahvash-ProjectHeaderstringOptionalMahvash extensionProject slug or ID within the caller's organization. Narrows the request principal; it can never widen it.

Request

curl -X GET 'https://api.mahvashai.ir/api/v1/chat/webhooks/<endpoint_id>' \
  -H "Authorization: Bearer $MAHVASH_USER_JWT"

Response

{
  "status": 0,
  "data": "<value>"
}

Illustrative response shape; actual fields depend on the operation and model.

Status codes

HTTPDetails
200One webhook subscription and its delivery health.
401Authentication credentials are missing or invalid.
403The principal is not allowed to perform this request.
404No such resource is visible to this principal.
429A quota or rate limit was exceeded.
500An internal error occurred.

Retune which events a subscription receives, or enable and disable it. The URL is immutable

PATCH/api/v1/chat/webhooks/{endpoint_id}
Production base URLhttps://api.mahvashai.ir
AuthenticationUser access JWT
ResponseMahvash product envelope
Content typeapplication/json

Parameters

The table shows the accepted inputs for this endpoint. Examples use placeholders and illustrate a safe integration pattern.

NameLocationTypeRequiredSupportDetails
endpoint_idPathstringRequiredMahvash extensionWebhook subscription ID.
X-Request-IDHeaderstringOptionalMahvash extensionClient-supplied correlation ID. Echoed on every response; replaced when absent or malformed.
X-Mahvash-ProjectHeaderstringOptionalMahvash extensionProject slug or ID within the caller's organization. Narrows the request principal; it can never widen it.
event_typesBodyarray<value>OptionalMahvash extensionReplacement list of event types.
statusBodystringOptionalMahvash extensionACTIVE or DISABLED. Re-enabling clears the automatic-disablement failure count.

Request

curl -X PATCH 'https://api.mahvashai.ir/api/v1/chat/webhooks/<endpoint_id>' \
  -H "Authorization: Bearer $MAHVASH_USER_JWT" \
  -H "Content-Type: application/json" \
  -d '{
  "event_types": [
    "response.failed"
  ]
}'

Response

{
  "status": 0,
  "data": "<value>"
}

Illustrative response shape; actual fields depend on the operation and model.

Status codes

HTTPDetails
200Retune which events a subscription receives, or enable and disable it. The URL is immutable.
400The request is not valid.
401Authentication credentials are missing or invalid.
403The principal is not allowed to perform this request.
404No such resource is visible to this principal.
429A quota or rate limit was exceeded.
500An internal error occurred.

Remove a webhook subscription and everything queued for it

DELETE/api/v1/chat/webhooks/{endpoint_id}
Production base URLhttps://api.mahvashai.ir
AuthenticationUser access JWT
ResponseMahvash product envelope

Parameters

The table shows the accepted inputs for this endpoint. Examples use placeholders and illustrate a safe integration pattern.

NameLocationTypeRequiredSupportDetails
endpoint_idPathstringRequiredMahvash extensionWebhook subscription ID.
X-Request-IDHeaderstringOptionalMahvash extensionClient-supplied correlation ID. Echoed on every response; replaced when absent or malformed.
X-Mahvash-ProjectHeaderstringOptionalMahvash extensionProject slug or ID within the caller's organization. Narrows the request principal; it can never widen it.

Request

curl -X DELETE 'https://api.mahvashai.ir/api/v1/chat/webhooks/<endpoint_id>' \
  -H "Authorization: Bearer $MAHVASH_USER_JWT"

Response

This endpoint returns no JSON body or delivers binary content.

Status codes

HTTPDetails
204Remove a webhook subscription and everything queued for it.
401Authentication credentials are missing or invalid.
403The principal is not allowed to perform this request.
404No such resource is visible to this principal.
429A quota or rate limit was exceeded.
500An internal error occurred.

List a project's webhook subscriptions. Never includes the signing secret

GET/api/v1/chat/projects/{project_id}/webhooks
Production base URLhttps://api.mahvashai.ir
AuthenticationUser access JWT
ResponseMahvash product envelope

Parameters

The table shows the accepted inputs for this endpoint. Examples use placeholders and illustrate a safe integration pattern.

NameLocationTypeRequiredSupportDetails
project_idPathstringRequiredMahvash extensionProject ID.
searchQuerystringOptionalMahvash extensionCase-insensitive search over endpoint URL and disabled reason.
statusQuerystringOptionalMahvash extensionFilter by ACTIVE or DISABLED.
pageQueryintegerOptionalMahvash extensionOne-based page number when bounded pagination is requested.
page_sizeQueryintegerOptionalMahvash extensionPage size from 1 through 100 when bounded pagination is requested.
X-Request-IDHeaderstringOptionalMahvash extensionClient-supplied correlation ID. Echoed on every response; replaced when absent or malformed.
X-Mahvash-ProjectHeaderstringOptionalMahvash extensionProject slug or ID within the caller's organization. Narrows the request principal; it can never widen it.

Request

curl -X GET 'https://api.mahvashai.ir/api/v1/chat/projects/<project_id>/webhooks' \
  -H "Authorization: Bearer $MAHVASH_USER_JWT"

Response

{
  "status": 0,
  "data": "<value>"
}

Illustrative response shape; actual fields depend on the operation and model.

Status codes

HTTPDetails
200List a project's webhook subscriptions. Never includes the signing secret.
401Authentication credentials are missing or invalid.
403The principal is not allowed to perform this request.
404No such resource is visible to this principal.
429A quota or rate limit was exceeded.
500An internal error occurred.

Recent delivery attempts. The receiver's response body is never stored

GET/api/v1/chat/webhooks/{endpoint_id}/deliveries
Production base URLhttps://api.mahvashai.ir
AuthenticationUser access JWT
ResponseMahvash product envelope

Parameters

The table shows the accepted inputs for this endpoint. Examples use placeholders and illustrate a safe integration pattern.

NameLocationTypeRequiredSupportDetails
endpoint_idPathstringRequiredMahvash extensionWebhook subscription ID.
searchQuerystringOptionalMahvash extensionCase-insensitive search over event ID, event type, and last error code.
statusQuerystringOptionalMahvash extensionFilter by delivery lifecycle status.
pageQueryintegerOptionalMahvash extensionOne-based page number when bounded pagination is requested.
page_sizeQueryintegerOptionalMahvash extensionPage size from 1 through 100 when bounded pagination is requested.
X-Request-IDHeaderstringOptionalMahvash extensionClient-supplied correlation ID. Echoed on every response; replaced when absent or malformed.
X-Mahvash-ProjectHeaderstringOptionalMahvash extensionProject slug or ID within the caller's organization. Narrows the request principal; it can never widen it.

Request

curl -X GET 'https://api.mahvashai.ir/api/v1/chat/webhooks/<endpoint_id>/deliveries' \
  -H "Authorization: Bearer $MAHVASH_USER_JWT"

Response

{
  "status": 0,
  "data": "<value>"
}

Illustrative response shape; actual fields depend on the operation and model.

Status codes

HTTPDetails
200Recent delivery attempts. The receiver's response body is never stored.
401Authentication credentials are missing or invalid.
403The principal is not allowed to perform this request.
404No such resource is visible to this principal.
429A quota or rate limit was exceeded.
500An internal error occurred.

The closed set of events a subscription may listen for

GET/api/v1/chat/webhooks/event-types
Production base URLhttps://api.mahvashai.ir
AuthenticationUser access JWT
ResponseMahvash product envelope

Parameters

The table shows the accepted inputs for this endpoint. Examples use placeholders and illustrate a safe integration pattern.

NameLocationTypeRequiredSupportDetails
X-Request-IDHeaderstringOptionalMahvash extensionClient-supplied correlation ID. Echoed on every response; replaced when absent or malformed.
X-Mahvash-ProjectHeaderstringOptionalMahvash extensionProject slug or ID within the caller's organization. Narrows the request principal; it can never widen it.

Request

curl -X GET 'https://api.mahvashai.ir/api/v1/chat/webhooks/event-types' \
  -H "Authorization: Bearer $MAHVASH_USER_JWT"

Response

{
  "status": 0,
  "data": "<value>"
}

Illustrative response shape; actual fields depend on the operation and model.

Status codes

HTTPDetails
200The closed set of events a subscription may listen for.
401Authentication credentials are missing or invalid.
429A quota or rate limit was exceeded.
500An internal error occurred.