Wallgone API docs

Make a link

Get a link to one page in one reader language.

POST /v1/linksPOST /v1/links/bulkUpdated Three minutes to read

Returns a link to one page in one reader language. The page address is saved to your account and listed in Dashboard → Links, marked as made through the API, so the link needs no signature.

At a glance

Method
POST
URL
https://wallgone.com/v1/links
Plan
Starter, Pro and Premium
Answer
200 with {"link", "short_link"}

Request body

FieldRequiredValue
urlYesThe page’s full address, starting with https:// or http://. Spaces around it are trimmed and the fragment (#…) is dropped. It must be a public web address: no IP address, port, user name, localhost or internal host name.
langYesThe reader’s language as a BCP 47 code, such as en, pt-BR or zh-Hant. Any language works. A page counts in its links’ languages and your bar’s without limit, and in up to three other languages a day, which readers reach by changing the link; past that, they get the original page. Case is corrected, so PT-br becomes pt-BR. See language and country for the codes that are refused.
countryNoTwo letters (ISO 3166-1), such as jp, in any case; the link gets them in lowercase. When the site refuses a direct load, the page is loaded through a connection in that country. Pro and Premium include these local connections; a plan without them ignores the country. Leave it out, or send null or "", for a link without one. Any other value is refused with bad_country.
lang_switchNoWhether the bar on this page offers your other languages: true shows the language menu, false keeps readers in lang. It applies to the page in this language, with or without a country. Leave it out to keep what the link has; a new link then follows the switch in Dashboard → Settings. You can change it later in Dashboard → Links.

Response

Status 200 with the link and its short form:

Response
{
  "link": "https://wallgone.link/city-weekly/en/jp/https://www.example.jp/news/4821",
  "short_link": "https://wallgone.link/Ab3xY9k"
}

https://wallgone.link is the translator origin; the one shown in Dashboard → Developers is the one your links use. city-weekly stands for your link name. The page address inside the link is in its canonical form. The same address and language always give the same link while your link name stays the same, so you can ask again instead of storing links.

short_link opens the same page: the translator sends the reader on to link. Use it where space is tight, such as a post, a text message or a QR code. Each address, language and country has one short link, the same every time you ask, and it keeps working if you change your link name.

Link format
{translator-origin}/{link-name}/{lang}/{page-url}
{translator-origin}/{link-name}/{lang}/{country}/{page-url}
  • {link-name} says the link is yours. It is made from your brand name the first time you make a link, and you can change it in Dashboard → Settings: 4 to 32 lowercase letters, digits and hyphens, not shaped like a language code (pt-br), and not used by another account. Your old names stay yours, so links you already sent keep working.
  • The link has no signature. Under your name, the translator opens only page addresses your account made a link for, in the dashboard or with this endpoint. Any other address under your name opens a page that says “This link doesn’t open a translated page” (status 404) and shows the address without sending the reader there.
  • The language and the country aren’t tied to the address. For a page you made a link for, change {lang} or {country} in the link to get another language or another country, without asking again.
  • Query parameters that newsletter platforms add after the address (utm_source, click ids, up to 10 of them) are ignored, and the page opens as you made the link.
  • Rotating the link signing key doesn’t affect these links.
  • On Pro and Premium, the page is loaded and translated into the link’s language right after you make the link, so its first reader doesn’t wait. It counts only when a reader opens it. Text the site’s own scripts add later is translated when a reader opens the page.
  • A short link, {translator-origin}/{code}, leads to the link. If you delete the link, the short link still leads there, and the original page opens, as for any deleted link.

Errors

StatusCodeWhen
401unauthorizedThe API key is missing, mistyped or revoked.
403not_in_planThe account is on Free, which has no API. Starter, Pro and Premium have it.
403inactiveThe account is suspended. This is checked before the body.
400bad_urlurl is missing or isn’t a full address, the body wasn’t read, or the address is one the translator never loads.
400unsafe_urlGoogle Safe Browsing lists the page as phishing, malware or unwanted software, so Wallgone won’t link to it.
400bad_langlang is missing or isn’t a language code the translator accepts.
400bad_countrycountry is set but isn’t two letters.
400bad_lang_switchlang_switch is set but isn’t true or false.

Example

curl
curl https://wallgone.com/v1/links \
  -H "Authorization: Bearer wg_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://www.example.jp/news/4821",
    "lang": "en",
    "country": "jp"
  }'

Many links at once

POST https://wallgone.com/v1/links/bulk makes up to 500 links in one request, with the same API key. Send links, a list of page addresses or of objects with the fields above. lang, country and lang_switch at the top of the body apply to every link that leaves them out.

curl
curl https://wallgone.com/v1/links/bulk \
  -H "Authorization: Bearer wg_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "lang": "en",
    "links": [
      "https://www.example.jp/news/4821",
      { "url": "https://www.example.jp/news/4822", "lang": "xx" }
    ]
  }'

The answer is 200 with one result for each link, in the order sent. A link that couldn’t be made has the error’s code and message instead, as a single request would get, and doesn’t stop the others:

Response
{
  "made": 1,
  "failed": 1,
  "results": [
    {
      "url": "https://www.example.jp/news/4821",
      "lang": "en",
      "country": null,
      "link": "https://wallgone.link/city-weekly/en/https://www.example.jp/news/4821",
      "short_link": "https://wallgone.link/Kp4wQ2m"
    },
    {
      "url": "https://www.example.jp/news/4822",
      "lang": "xx",
      "status": 400,
      "error": "bad_lang",
      "message": "Choose the language readers should get, like en or pt-BR."
    }
  ]
}
  • Making a link that exists gives the same link again, so a request that got no answer can be sent again whole.
  • A failed result has url, lang, status, error and message.
  • The whole request is refused only when the key is wrong (401 unauthorized), the plan has no API (403 not_in_plan), the account is suspended (403 inactive), or links isn’t a list of 1 to 500 (400 bad_links). For more links, send several requests.
  • The same page, language and country twice in one request is one link, given in both places.
  • On Pro and Premium, the pages are translated ahead one after another in the minutes that follow, up to your plan’s pages a month (1,000 on Pro, 3,000 on Premium), all at once if you make them at once, while the month’s pages last. A page that isn’t reached is translated when its first reader opens it.
  • In the dashboard, Links → Many links takes the same lists pasted as text, or an Excel (.xlsx), CSV or TSV file, and gives the links back as a CSV.
Was this page useful?