Developer API

LoomexAPI Documentation

Build powerful integrations with our comprehensive REST API. Simple, secure, and scalable.

Getting Started

Get up and running with the Loomex API in minutes. Follow these simple steps to make your first API call.

1

Authentication

First, you need to authenticate with your Loomex credentials to obtain an access token.

Step 1: Login to get your token

curl \
    --request POST \
    --header 'Content-Type: application/json' \
    --data '{ "email": "hello@example.com", "password": "pass12345" }' \
    --url 'https://admin.loomex.io/auth/login'

Response:

{
  "data": {
    "expires": 900000,
    "access_token": "edsfsgfdgdjjkjyJz93a...",
    "refresh_token": "k4lagdjsah6dssUWw..."
  }
}

Step 2: Use the token in API requests

Include the access token in the Authorization header for all subsequent API calls.

curl -H "Authorization: Bearer edsfsgfdgdjjkjyJz93a..." \
     -H "Content-Type: application/json" \
     https://admin.loomex.io/users/me

Token Information

  • Access Token: Use this for API requests (expires in 15 minutes)
  • Refresh Token: Use this to get a new access token when it expires
  • Expires: Token lifetime in milliseconds (900000 = 15 minutes)
2

Your First API Call

Let's retrieve your current user information to verify everything is working correctly.

// First, login to get your token
const loginResponse = await fetch('https://admin.loomex.io/auth/login', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    email: 'hello@example.com',
    password: 'pass12345'
  })
});

const loginData = await loginResponse.json();
const accessToken = loginData.data.access_token;

// Then use the token for API calls
const response = await fetch('https://admin.loomex.io/users/me', {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${accessToken}`,
    'Content-Type': 'application/json'
  }
});

const userInfo = await response.json();
console.log(userInfo);
3

List Product Variants

Now let's fetch all product variants to see your inventory data.

// Assuming you have the access token from login
const variants = await fetch('https://admin.loomex.io/api/variants', {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${accessToken}`,
    'Content-Type': 'application/json'
  }
});

const variantsData = await variants.json();
console.log('Product variants:', variantsData);

// You can also add query parameters for filtering
const filteredVariants = await fetch('https://admin.loomex.io/api/variants?limit=10&page=1', {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${accessToken}`,
    'Content-Type': 'application/json'
  }
});

const filteredData = await filteredVariants.json();
console.log('Filtered variants:', filteredData);