Getting started overview

This guide provides a structured approach for developers to initiate usage of Microlink.io services. The process involves account creation, API key retrieval, and executing a foundational API request to confirm setup. Microlink.io is designed to provide programmatic access to web data, offering capabilities such as generating screenshots, extracting structured metadata, and acting as a web scrapring bypass solution.

Microlink.io operates as a RESTful API. This architectural style, commonly used in web services, leverages standard HTTP methods to interact with resources, making it accessible from various programming environments. For more detailed information on REST architectural principles, refer to the W3C REST architecture overview.

The following table outlines the key steps to get started with Microlink.io:

Step What to do Where
1. Create Account Register for a Microlink.io user account. Microlink.io homepage
2. Get API Key Locate and copy your unique API key from your dashboard. Microlink.io API Keys documentation
3. Install SDK (Optional) Install the relevant SDK for your programming language. Microlink.io SDK documentation
4. Make First Request Execute a basic API call using your key. Microlink.io API Getting Started guide
5. Explore Features Review additional API parameters and endpoints. Microlink.io API reference overview

Create an account and get keys

To access Microlink.io's API, an account is required. This grants access to the dashboard where API keys are managed and usage is monitored. Microlink.io offers a free tier of 500 requests per month, which is sufficient for initial testing and development.

  1. Navigate to the Microlink.io Website: Open your web browser and go to the Microlink.io homepage.
  2. Sign Up for an Account: Look for a 'Sign Up' or 'Get Started' button. The registration process typically requires an email address and password.
  3. Verify Your Email: After submitting your registration, you may receive an email to verify your account. Follow the instructions in the email to complete this step.
  4. Access Your Dashboard: Once logged in, you will be directed to your personal Microlink.io dashboard. This is where you can view your subscription details, usage, and API keys.
  5. Locate Your API Key: Within your dashboard, there will be a section dedicated to API keys or credentials. Your unique API key will be displayed here. It is a long string of alphanumeric characters. Copy this key securely, as it will be used to authenticate all your API requests. For specific instructions on locating the key, consult the Microlink.io API Keys documentation.

API keys are fundamental for authentication in many web services. They identify the calling application or user and ensure that only authorized entities can access the API. Best practices for API key management include storing keys securely (e.g., in environment variables, not directly in code) and regenerating them periodically if the platform supports it.

Your first request

After obtaining your API key, you can make your first API call. This example demonstrates how to use the Microlink.io API to extract metadata from a URL. The API endpoint for metadata extraction is https://api.microlink.io/, and you pass the target URL as a query parameter.

We will use curl for this example, as it is a universally available command-line tool for making HTTP requests and does not require any additional software installation beyond what's typically available on most operating systems.

cURL Example: Extracting Metadata

Replace YOUR_API_KEY with the actual API key you copied from your Microlink.io dashboard.

curl -X GET 'https://api.microlink.io/?url=https://docs.microlink.io&sceenshot=true&embed=true' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'accept: application/json'

In this example:

  • -X GET specifies the HTTP method as GET.
  • 'https://api.microlink.io/?url=https://docs.microlink.io&sceenshot=true&embed=true' is the API endpoint, with url being the target website for metadata extraction and screenshot and embed as additional parameters.
  • -H 'x-api-key: YOUR_API_KEY' passes your API key in the x-api-key HTTP header for authentication. This is a common method for HTTP authentication.
  • -H 'accept: application/json' requests the response in JSON format.

A successful response will return a JSON object containing the extracted website data, including title, description, images, and potentially a screenshot URL if screenshot=true was specified.

Node.js Example (using microlink-api SDK)

If you prefer to use a Node.js SDK, first install the microlink-api package:

npm install microlink-api

Then, you can use the following code:

const m = require('microlink-api')('YOUR_API_KEY');

(async () => {
  try {
    const { status, data } = await m('https://docs.microlink.io', {
      screenshot: true,
      embed: true
    });
    console.log(`Status: ${status}`);
    console.log('Data:', data);
  } catch (error) {
    console.error('Error:', error.message);
  }
})();

This Node.js example performs the same operation as the cURL command but leverages the convenience of the official SDK, which handles request formatting and authentication.

Common next steps

After successfully making your first API call, consider these next steps to deepen your integration and utilize Microlink.io's capabilities:

  1. Explore API Parameters: Microlink.io APIs offer various parameters to customize requests. For instance, the screenshot API allows specifying full-page screenshots, device emulation, or specific elements to capture. Review the Microlink.io API reference to understand all available options and how they can be used to meet specific data extraction or content generation needs.
  2. Integrate with Your Application: Move beyond simple cURL requests. Integrate the API calls into your application's backend or frontend logic using one of the supported programming languages (Node.js, Python, PHP, Go, Ruby). The Microlink.io SDK documentation provides examples for seamless integration.
  3. Utilize Advanced Features: Beyond basic metadata and screenshots, explore features like the Proxy API for bypassing common web scraping obstacles, the MQL API for custom selectors, or the Insights API for performance metrics. These advanced features can provide deeper insights or enable more complex automation tasks.
  4. Understand Rate Limits and Quotas: Familiarize yourself with the Microlink.io pricing and usage policies. Understanding your plan's request limits and how they are reset will help prevent unexpected service interruptions. The free tier offers 500 requests per month, with paid plans scaling up based on volume.
  5. Implement Error Handling: As with any external API, implementing robust error handling is crucial. Design your application to gracefully manage network issues, invalid API keys, or API-specific error responses. Refer to the Microlink.io error handling documentation for specific error codes and messages.
  6. Monitor Usage: Regularly check your Microlink.io dashboard to monitor API usage. This helps manage costs and ensures you remain within your allocated request limits.

Troubleshooting the first call

Encountering issues during your first API call is common. Here are some troubleshooting steps:

  • Invalid API Key: Double-check that you have copied the API key correctly and included it in the x-api-key header. If you suspect your key might be compromised or incorrect, you can often regenerate it from your Microlink.io dashboard.
  • Incorrect URL Formatting: Ensure the target URL passed to the url parameter is correctly encoded and accessible. Special characters in URLs might need URL encoding.
  • Missing Headers: Verify that all required HTTP headers, especially x-api-key, are present and correctly formatted. The accept: application/json header is generally good practice to request JSON responses.
  • Network Connectivity: Confirm your internet connection is stable and that no firewalls or proxies are blocking outgoing requests to api.microlink.io.
  • Rate Limits: If you are making many requests in a short period, you might hit rate limits, especially on the free tier. Check your dashboard for usage statistics.
  • API Endpoint Issues: While Microlink.io's API is generally stable, check their status page if you suspect a service-wide issue.
  • Check Microlink.io Docs: The official Microlink.io documentation provides detailed error codes and explanations that can help diagnose specific problems. Look for the API reference section related to the service you are trying to use.
  • Review Response Body: The API response body often contains detailed error messages that can guide you to the specific problem. Always log or print the full response when debugging.