---
updatedAt: 2025-09-17T22:29:08.000Z
agentTools:
  projectIndex: https://docs.vizionapi.com/llms.txt
---

# Store metadata in callback URL

```node Node
// Client-side code
const axios = require('axios');

const url = 'https://prod.vizionapi.com/references';
const apiKey = 'YOUR_API_KEY_HERE';
// Construct the callback URL with a query parameter for the variable po_number
// ${po_number} is a variable that will be repalced with the actual value when sending the request
const callbackURL = 'https://yourdomain.com/webhook?po_number=${po_number}';

const data = {
  "container_id": "MEDU8381210",
  "carrier_code": "MSCU",
  "callback_url": callbackURL
};

axios.post(url, data, {
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': apiKey
  }
})
.then(response => {
  console.log(response.data);
})
.catch(error => {
  console.error('Error:', error);
});

// Server-side code 
const express = require('express');
const bodyParser = require('body-parser');

const app = express();
app.use(bodyParser.json());

app.post('/webhook', (req, res) => {
  const po_number = req.query.po_number;

  console.log('Received callback for PO Number:', po_number);
  console.log('Request body:', req.body);

  res.sendStatus(200);
});


```

```json Response Example
{"success":true}
```

# Import necessary dependencies and define variables

<!-- node@1-8 -->

This step includes importing the Axios library, defining the URL and API key, and constructing the callback URL with a placeholder for the purchase order number (po_number).

# Send a POST request to create a reference

<!-- node@10-28 -->

Client sends a POST request using Axios to the specified URL with the payload data - including a container ID, carrier code, and the constructed callback URL.

# Server-side setup



This step involves importing Express and body-parser, initializing an app, and configuring it to use JSON body parsing middleware.

# Handle incoming webhook requests



Server defines a POST route at /webhook to handle incoming webhook requests. It extracts the po_number query parameter from the request URL, logs the received data and the PO number, and sends a successful response with status code 200.