Automate link creation

Automate link creation with the Weespin API

If you manage multiple marketing campaigns or want to generate dynamic links directly from your application or backend, manual link creation quickly becomes limiting.
With the Weespin API, you can create and manage your links automatically, while integrating personalized parameters like UTM or deeplinks.

Get your API keys

  1. Log into your Weespin dashboard.
  2. Go to your application.
  3. Go to the Configuration section.
  4. In Integration:
    • Generate the API key that will be used to identify your application.

Understand the API documentation

Before coding, it's essential to know:

  • API base URL:
    API_BASE_URL
    https://developer.weespin.com
    
  • Main endpoint:
    POST /create-link → create a new link
  • Required parameters:
    target_urlstring
    destination URL of the link.
    domainstring
    custom domain if necessary
    titlestring
    internal name of the link
    descriptionstring
    link description
    segmentsstring[]
    e.g: ["tech", "mobile"]
    customParamsstring[]
    UTM, expiration, password, deeplink, etc. (e.g: ["utm","name"])
const axios = require("axios");

async function createLink() {
  try {
    const response = await axios.post(
      "https://developer.weespin.com/create-link",
      {
        title: "My link",
        description: "Test description",
        segments: ["news", "bananas"],
        customParams: ["utm", "productId"],
      },
      {
        headers: {
          Authorization: "YOUR_API_KEY",
          "Content-Type": "application/json",
        },
      }
    );

    console.log("Link created:", response.data.url);
    return response.data;
  } catch (error) {
    console.error(
      "Error creating link:",
      error.response?.data || error.message
    );
  }
}

createLink();

Conclusion

You now have the tools to automate your link creation!
Integrate the Weespin API into your applications to generate personalized and tracked links programmatically.