Skip to content

    Arabic or English · ↑↓ to move · Enter to open · Esc to close

    العربية
    On this page

    Messages

    Upload media once, send many times

    POST/v2/media
    • Scope:messages:send
    • Idempotency-Key:optional
    • number key ok— Also accepts the legacy per-number x-api-key, for its own number.
    • uses quota

    Returns a media id valid 24 h on the same number. Also accepts JSON {"numberId", "url"}.

    Request

    curl -X POST "https://mursilat.com/api/v2/media" \
      -H "Authorization: Bearer $WASLA_API_KEY" \
      -H "Idempotency-Key: order-1042-confirm" \
      -F numberId="cm1abcd2345efgh6789ijkl" \
      -F file=@logo.png

    The curl example includes the multipart/form-data fields and file.

    Response

    200Example

    200 — application/json
    {
      "mediaId": "med_8f2c1d9a7b3e4f56a1b2c3d4",
      "mimeType": "image/png",
      "size": 48213,
      "fileName": "logo.png",
      "expiresAt": "2026-10-14T08:00:00.000Z",
      "numberId": "cm1abcd2345efgh6789ijkl"
    }

    Fields in this response

    Fields of the example answer. Expand objects and arrays.

    • responseobject6 fields
      • mediaIdstring "med_8f2c1d9a7b3e4f56a1b2c3d4"
      • mimeTypestring "image/png"
      • sizeinteger 48213
      • fileNamestring "logo.png"
      • expiresAtstring "2026-10-14T08:00:00.000Z"
      • numberIdstring "cm1abcd2345efgh6789ijkl"

    Parameters

    Headers

    NameTypeConstraintsDescription
    Idempotency-KeyoptionalTypestringConstraints≤ 191 charsDescriptionYour unique id for this operation (≤ 191 visible ASCII). A retry with the same key and body returns the first answer with Idempotent-Replayed: true — it never runs twice. Kept 24 h.
    X-Request-IdoptionalTypestringConstraints—DescriptionOptional: your own request id, echoed back (otherwise we generate req_…). Quote it to support.

    multipart/form-data fields

    NameTypeConstraintsDescription
    numberIdoptionalTypestringConstraints—DescriptionThe number that will send the file — an upload can be used by that number only, for 24 hours.
    fileoptionalTypefileConstraints—DescriptionThe file bytes (multipart). The real type is sniffed from the bytes; the file name is never trusted.

    Errors

    Besides the authentication, rate-limit and validation errors every endpoint can return:

    • 400 · MESSAGE_MEDIA_REQUIRED — A file / media is required.

      Send media.url, media.id or a multipart file.

      Correct the cause before repeating the request.

      HTTP 400 · application/json
      {
        "error": {
          "code": "MESSAGE_MEDIA_REQUIRED",
          "message": "A file / media is required.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#MESSAGE_MEDIA_REQUIRED",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 413 · MESSAGE_MEDIA_TOO_LARGE — File over the type limit.

      See details.limitBytes.

      Correct the cause before repeating the request.

      HTTP 413 · application/json
      {
        "error": {
          "code": "MESSAGE_MEDIA_TOO_LARGE",
          "message": "File over the type limit.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#MESSAGE_MEDIA_TOO_LARGE",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 422 · MESSAGE_MEDIA_FETCH_FAILED — media.url could not be fetched safely.

      Use a public https URL that answers within 20 s.

      Retry after addressing the cause.

      HTTP 422 · application/json
      {
        "error": {
          "code": "MESSAGE_MEDIA_FETCH_FAILED",
          "message": "media.url could not be fetched safely.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#MESSAGE_MEDIA_FETCH_FAILED",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 400 · IDEMPOTENCY_KEY_INVALID — Idempotency-Key must be 1–191 visible ASCII characters.

      Use e.g. order-1042-confirm.

      Correct the cause before repeating the request.

      HTTP 400 · application/json
      {
        "error": {
          "code": "IDEMPOTENCY_KEY_INVALID",
          "message": "Idempotency-Key must be 1–191 visible ASCII characters.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#IDEMPOTENCY_KEY_INVALID",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 409 · IDEMPOTENCY_KEY_REUSED — This Idempotency-Key was used with a different request.

      Use a new key for a new request.

      Correct the cause before repeating the request.

      HTTP 409 · application/json
      {
        "error": {
          "code": "IDEMPOTENCY_KEY_REUSED",
          "message": "This Idempotency-Key was used with a different request.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#IDEMPOTENCY_KEY_REUSED",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 409 · IDEMPOTENCY_IN_PROGRESS — The first request with this key is still running.

      Retry in a few seconds.

      Retry after addressing the cause.

      HTTP 409 · application/json
      {
        "error": {
          "code": "IDEMPOTENCY_IN_PROGRESS",
          "message": "The first request with this key is still running.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#IDEMPOTENCY_IN_PROGRESS",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 403 · SCOPE_REQUIRED — The key lacks the scope of this endpoint.

      Add the scope in details.required to the key.

      Correct the cause before repeating the request.

      HTTP 403 · application/json
      {
        "error": {
          "code": "SCOPE_REQUIRED",
          "message": "The key lacks the scope of this endpoint.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#SCOPE_REQUIRED",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 401 · API_KEY_REQUIRED — No API key was sent.

      Send Authorization: Bearer wsl_live_…

      Correct the cause before repeating the request.

      HTTP 401 · application/json
      {
        "error": {
          "code": "API_KEY_REQUIRED",
          "message": "No API key was sent.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#API_KEY_REQUIRED",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 401 · API_KEY_INVALID — The API key is not valid.

      Copy the key again from Settings → API keys (it is shown only once; create a new one if lost).

      Correct the cause before repeating the request.

      HTTP 401 · application/json
      {
        "error": {
          "code": "API_KEY_INVALID",
          "message": "The API key is not valid.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#API_KEY_INVALID",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 429 · RATE_LIMITED — Rate limit of this key reached.

      Wait Retry-After seconds; watch X-RateLimit-Remaining.

      Retry after addressing the cause.

      HTTP 429 · application/json
      {
        "error": {
          "code": "RATE_LIMITED",
          "message": "Rate limit of this key reached.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#RATE_LIMITED",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors

    Errors →

    Try it

    Send this request from your browser to the Mursilat API.

    documented example

    Preview — this copy of the docs isn’t on mursilat.com, so the console shows the documented example instead of calling the API.

    Real requests use your real number and plan: they can send WhatsApp messages, spend quota and delete data. (uses quota)

    Kept only in this tab’s memory: never saved, never put in the URL, sent only to mursilat.com. Reloading the page forgets it.

    multipart/form-data → curl
    The same request with curl
    curl -X POST 'https://mursilat.com/api/v2/media' \
      -H "Authorization: Bearer $WASLA_API_KEY" \
      -H 'Accept: application/json'

    Send this request for real?

    This uses your plan quota or credits.

    POST https://mursilat.com/api/v2/media