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

# Find Vizion carrier code from carrier scac

```javascript JavaScript
const axios = require('axios');

const findCarrierCodeFromSCAC = async(scac) => {
    const apiUrl = `https://prod.vizionapi.com/carriers`;
    const apiKey = 'YOUR_API_KEY_HERE'; // Replace 'YOUR_API_KEY_HERE' with your actual API key

    const options = {
        method: 'GET',
        url: apiUrl,
        headers: {
            accept: 'application/json',
            'X-API-Key': apiKey,
        }
    };

    try {
        const response = await axios(options);
        const carriers = response.data;

        const foundCarrier = carriers.find(carrier => carrier.scac === scac.toUpperCase());

        if (foundCarrier) {
            return foundCarrier.carrier_code;
        } else {
            return "Carrier code not found for provided SCAC.";
        }
    } catch (error) {
        console.error('Error:', error);
        return "Error occurred while fetching carrier data.";
    }
}

const scacInput = "HYUD";

findCarrierCodeFromSCAC(scacInput)
    .then(carrierCode => console.log(`Carrier Code for SCAC '${scacInput}': ${carrierCode}`))
    .catch(error => console.error(error));

```

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

# Set up API request

<!-- javascript@1-14 -->

Define the List carriers endpoint URL and API key that will be used for authorization. Construct the options object for the request.

# Find the carrier code associated with the SCAC input

<!-- javascript@16-31 -->

Use the List carriers response to search for the provided scac. If found, return the associated carrier code or a message indicating the SCAC was not found.

# Example usage

<!-- javascript@33-38 -->

Specify an example SCAC input. Call the findCarrierCodeFromSCAC function with the input. Log the result, which will be the carrier code associated with the SCAC or an error message.