Articles in this section

Configure lookups, imports, guardrails, AI agents, and tools in API builder

After configuring your API request and responses, you can incorporate lookups, imports, guardrails, AI agents, and tools into your API.

Lookups allow your API to dynamically reference and retrieve critical data from connected systems or internal repositories, ensuring that each transaction is enriched with accurate and current information.

Imports facilitate the integration of external data and enable you to update records or execute specific actions based on that data.

Guardrails are import-type flow steps that evaluate individual records against safety, compliance, or governance policies, returning a structured JSON result that flags whether a record violates a configured policy. Learn more about guardrails.

AI agents utilize AI models to process each record within your API. For every record, the Celigo platform sends the mapped input data to the Celigo AI agent, which then provides a standardized response that can be mapped for subsequent steps in the API. Learn more about AI agents in Celigo.

Tools are reusable, schema-driven building blocks within Celigo that allow you to encapsulate integration logic — such as lookups, imports, mappings, and conditional branching — behind a strict JSON-based input and output contract. Learn more about tools.

Combined with branching, transformations, and other step components, these features empower your API to execute sophisticated business logic, enforce data integrity, and drive real-time decision-making across your operations.

Warning

You must enable the Skip aggregation setting if you're pushing resources or APIs to API Management using any of the following import applications:

Why add a lookup, import, guardrail, AI agent, or tool

You can't create an API without adding lookups, imports, guardrails, AI agents, and/or tools. These steps allow you to execute your API. For example, if you want to create an API to retrieve pet data from a pet store, you need to:

  1. Create an API request: This determines how the user will request your data (e.g., authentication, headers, query and path parameters, etc.).

  2. Add a lookup: This will retrieve your pet data from the pet store database.

  3. Create an API response: This determines the response you send to your API consumer (e.g., success, failed, etc.).

You're not retrieving pet data from a pet store without a lookup.

Get_a_pet_API_builder.png

Add a lookup, import, guardrail, AI agent, or tool

To create or add a resource, navigate to your API builder and add a step using the plus sign (+) to the right of the API request:

Add_destination_lookup_branching.png
  1. Click Add <Resource>.

  2. Create a new resource, use a pre-built step created by Celigo, or add an existing resource.

  3. Add a Name and Description.

  4. Create or use an existing connection to an application. The requirements for creating a connection vary greatly depending on the application. Always check the requirements for your specific application by searching for the application in our help center. If you're using a universal connector, you'll need to use a search engine like Google, Bing, or DuckDuckGo to find the API requirements for your application.

  5. Build your resource. Here's an example HTTP import, an AI agent, a tool, and a guardrail.

    Note

    You can use the Override request/response media type field in imports to use a different media type (e.g., XML or CSV). However, the final API response must be in JSON.

  6. Add additional configurations to your resource. This can include:

    tools.png
    1. Transformations transform.svg

    2. Input filterIn.svg and output filterOut.svg filters 

    3. Mappings mapping.svg

    4. Hooks and scripts ​​hook.svg​​

    5. Use Failed records (Failed_records_option.svg) to choose whether the process should stop and return an error in the API response node if a record fails or continue to the next step. Based on the error code received at the Response picker, branching rules can be added, an error response can be configured and customized, and an error message can be sent to the user. When one of the lookups or imports encounters an error, you can:

      Tip

      You can configure additional error handling aside from failed records.

      1. Stop and return error via the API response node: This is the default. The API execution will stop for the record, and the errors array (including the error code, message, and source) will automatically be available in the API response branching node. Additionally, the “Success” boolean in the API response will be updated to false.

      2. Proceed to the next application regardless: The API execution will continue to the next step; however, the "errors" array needs to be manually mapped in results/response mapping to use that information in downstream steps.

API builder examples

Get all pet stores

Relative URI: /stores/

This API includes one request, one lookup, and two responses.

Get_pet_stores_api.png

API request

{
  "method": "GET",
  "endpoint": "/stores/",
  "headers": {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json"
  },
  "query_parameters": {
    "limit": 10,
    "offset": 0,
    "sort": "name",
    "order": "asc"
  }
}

Lookup: Get all pet stores

A lookup allows you to process the request data and use it to search ("look up") the information for all pet stores. In this lookup step, you'll want to configure the request mapping so the data your API consumer sends is properly mapped to your database.

API response: Successful retrieval of pet stores

{
  "status": "success",
  "data": {
    "stores": [
      {
        "id": 123,
        "name": "Happy Paws Pet Store",
        "location": "123 Main St, Springfield, IL",
        "phone": "+1-555-1234",
        "hours": {
          "monday": "8 AM - 6 PM",
          "tuesday": "8 AM - 6 PM",
          "wednesday": "8 AM - 6 PM",
          "thursday": "8 AM - 6 PM",
          "friday": "8 AM - 6 PM",
          "saturday": "9 AM - 3 PM",
          "sunday": "Closed"
        }
      },
      {
        "id": 124,
        "name": "Furry Friends Pet Store",
        "location": "456 Elm St, Austin, TX",
        "phone": "+1-555-5678",
        "hours": {
          "monday": "9 AM - 5 PM",
          "tuesday": "9 AM - 5 PM",
          "wednesday": "9 AM - 5 PM",
          "thursday": "9 AM - 5 PM",
          "friday": "9 AM - 5 PM",
          "saturday": "10 AM - 2 PM",
          "sunday": "Closed"
        }
      }
    ]
  }
}

API response: 400 Bad Request (Invalid Query Parameters)

{
  "status": "error",
  "code": 400,
  "message": "Invalid query parameters: 'page_size' must be a positive integer.",
  "errors": {
    "page_size": "Must be greater than 0"
  }
}

Get a pet

This API includes one request, three lookups, and two responses. The request retrieves details of a specific pet and its health records from a store.

Relative URI: /stores/:storeId/pets/:petId,

Get_a_pet_API_builder.png

API request

  • storeId (123): Represents the specific store (vet office or pet store).

  • petId (101) → Unique identifier for the pet.

{
  "method": "GET",
  "endpoint": "/stores/123/pets/101",
  "headers": {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json"
  }
}

Lookup: Get a dog

A lookup allows you to process the request data and use it to search for ("look up") a dog. In this lookup step, you'll want to configure the request mapping so the data your API consumer sends is properly mapped to your database.

Lookup: Get a cat

A lookup allows you to process the request data and use it to search for ("look up") a cat. In this lookup step, you'll want to configure the request mapping so the data your API consumer sends is properly mapped to your database.

Lookup: Get health records

A lookup allows you to process the request data and use it to search for ("look up") the dog or cat's health records. In this lookup step, you'll want to configure the request mapping so the data your API consumer sends is properly mapped to your database.

API response: Successful retrieval of pet

{
  "status": "success",
  "data": {
    "id": 101,
    "name": "Buddy",
    "age": 3,
    "breed": "Labrador Retriever",
    "weight_kg": 28.5,
    "store": {
      "id": 123,
      "name": "Happy Paws Pet Store",
      "location": "123 Main St, Springfield, IL",
      "phone": "+1-555-1234"
    },
    "owner": {
      "id": 1001,
      "name": "John Doe",
      "phone": "+1-555-1234"
    },
    "last_visit": "2024-01-15",
    "vaccinations": ["Rabies", "Distemper", "Parvovirus"]
  }
}

API response: 400 Bad Request (Invalid Query Parameters)

{
  "status": "error",
  "code": 400,
  "message": "Invalid query parameters: 'page_size' must be a positive integer.",
  "errors": {
    "page_size": "Must be greater than 0"
  }
}

Create a new pet

This request creates a new pet using the relative URI: /stores/:storeId/pets/. It includes one request, one import, four branches, and four responses. Each branch ends in a different response node.

Note

In this example, the API request data and the API response data are identical. In practice, the API request data may include different or additional fields. This is where mapping helps.

API request body

  • Uses POST /stores/123/pets/ to create a new pet in store ID 123.

  • Includes detailed pet information such as microchip ID, breed information, and medical history.

{
  "name": "Buddy",
  "age": 3,
  "breed": "Labrador Retriever",
  "weight_kg": 28.5,
  "microchip_id": "982000411234567",
  "owner": {
    "id": 1001,
    "name": "John Doe",
    "phone": "+1-555-1234"
  },
  "last_visit": "2024-01-15",
  "vaccinations": ["Rabies", "Distemper", "Parvovirus"],
  "medical_history": [
    {
      "date": "2023-06-10",
      "condition": "Ear infection",
      "treatment": "Antibiotics"
    },
    {
      "date": "2022-09-05",
      "condition": "Allergic reaction",
      "treatment": "Antihistamines"
    }
  ],
  "dietary_preferences": {
    "food_brand": "Hill’s Science Diet",
    "meal_frequency": 2,
    "allergies": ["Chicken", "Soy"]
  },
  "exercise_routine": {
    "daily_walks": 2,
    "walk_duration_minutes": 30,
    "favorite_activity": "Fetch"
  }
}

 

Import: Create a new pet

An import step allows you to take the request data provided above and send it to your database, thus adding the pet to the database. In this import step, you'll want to configure the import and response mapping so the data your API consumer sends is properly mapped to your database.

API response: Successful Pet Creation

This is one branch ending in a successful pet creation. You'll want to add API response schema mapping here to include the unique ID and any other data you'd like to include in your response.

  • 201 Created → Indicates successful creation.

  • Includes a unique ID (101) for the newly created pet.

  • Returns a timestamp (created_at) to confirm when the record was created.

{
  "status": "success",
  "message": "Pet record created successfully.",
  "data": {
    "id": 201,
    "name": "Buddy",
    "age": 3,
    "breed": "Labrador Retriever",
    "weight_kg": 28.5,
    "microchip_id": "982000411234567",
    "store": {
      "id": 123,
      "name": "Happy Paws Veterinary Clinic",
      "location": "123 Main St, Springfield, IL"
    },
    "owner": {
      "id": 1001,
      "name": "John Doe",
      "phone": "+1-555-1234"
    },
    "last_visit": "2024-01-15",
    "vaccinations": ["Rabies", "Distemper", "Parvovirus"],
    "medical_history": [
      {
        "date": "2023-06-10",
        "condition": "Ear infection",
        "treatment": "Antibiotics"
      },
      {
        "date": "2022-09-05",
        "condition": "Allergic reaction",
        "treatment": "Antihistamines"
      }
    ],
    "dietary_preferences": {
      "food_brand": "Hill’s Science Diet",
      "meal_frequency": 2,
      "allergies": ["Chicken", "Soy"]
    },
    "exercise_routine": {
      "daily_walks": 2,
      "walk_duration_minutes": 30,
      "favorite_activity": "Fetch"
    },
    "created_at": "2025-02-10T14:30:00Z"
  }
}

API response: Bad Request (Missing Required Fields)

This is one branch ending in a "bad request" response.

{
  "status": "error",
  "message": "Missing required fields: name, breed"
}

API response: 401 Unauthorized (Invalid API Token)

This is one branch ending in an "unauthorized" response.

{
  "status": "error",
  "message": "Unauthorized. Invalid API token."
}

API response: 409 Conflict (Duplicate Microchip ID)

This is one branch ending in a "conflict" response.

{
  "status": "error",
  "message": "A pet with this microchip ID already exists."
}

Composite API: Get pet, add a pet, and order pet food

Here’s an example of a composite API. This request performs multiple actions in a single API call. The relative URI in this case is /v1/composite . This API enables you to:

  • Checks if the pet exists in the system using its microchip_id.

  • A new pet record is added to the system if the pet does not exist.

  • If the pet exists, it orders pet food based on the pet’s dietary preferences.

Note

In this example, the API request data and the API response data are identical. In practice, the API request data may include different or additional fields. This is where mapping helps.

API request body

  • Methods (POST) – Defines the HTTP method to be used.

  • Requests Array – Specifies each action that can be performed:

    • Get Pet (getPet) – Fetches pet details using a petId.

    • Create Pet (createPet) – Creates pet details using the response from getPet.

    • Create Order (createOrder) – Places an order only after the pet is updated.

  • Dependencies (dependsOn) – Ensures correct execution order.

  • Aggregated Response – Combines all individual responses into a single output.

{
  "transactions": [
    {
      "id": "get_pet",
      "method": "GET",
      "endpoint": "/pets",
      "query_parameters": {
        "microchip_id": "982000411234567"
      }
    },
    {
      "id": "create_pet",
      "method": "POST",
      "endpoint": "/pets",
      "dependsOn": "get_pet",
      "condition": "not_found",
      "body": {
        "name": "Buddy",
        "age": 3,
        "breed": "Labrador Retriever",
        "weight_kg": 28.5,
        "microchip_id": "982000411234567",
        "owner": {
          "id": 1001,
          "name": "John Doe",
          "phone": "+1-555-1234"
        },
        "last_visit": "2024-01-15",
        "vaccinations": ["Rabies", "Distemper", "Parvovirus"],
        "medical_history": [
          {
            "date": "2023-06-10",
            "condition": "Ear infection",
            "treatment": "Antibiotics"
          }
        ],
        "dietary_preferences": {
          "food_brand": "Hill’s Science Diet",
          "meal_frequency": 2,
          "allergies": ["Chicken", "Soy"]
        }
      }
    },
    {
      "id": "order_pet_food",
      "method": "POST",
      "endpoint": "/stores/123/orders",
      "dependsOn": "get_pet",
      "condition": "success",
      "body": {
        "order_type": "pet_food",
        "pet_id": "$get_pet.id",
        "store_id": 123,
        "food_brand": "$get_pet.dietary_preferences.food_brand",
        "quantity_kg": 5,
        "order_date": "2025-02-10T14:30:00Z",
        "status": "Processing",
        "delivery_time": "2025-02-11T10:00:00Z",
        "special_requests": "Grain-free variant if available"
      }
    }
  ]
}

Lookup: Get a pet

A lookup step allows you to retrieve pet details. In this lookup step, you'll want to configure the request mapping so the data your API consumer sends is properly mapped to your database.

Import: Add a pet

An import step allows you to take the request data provided above and send it to your database, thus adding a pet. In this import step, you'll want to configure the import and mappings so the data your API consumer sends is correctly mapped to your database.

Import: Create an order

An import step allows you to take the request data provided above and send it to your database, thus creating an order for a pet. In this import step, you'll want to configure the import and mappings so the data your API consumer sends is correctly mapped to your database.

API response: Successful

This is one branch ending in a successful response. You'll want to add API response schema mapping here to include the unique ID and any other data you'd like to include in your response.

  • 201 Created → Indicates successful creation.

  • Includes a unique ID (101) for the newly created pet.

  • Returns a timestamp (created_at) to confirm when the record was created.

{
  "status": "success",
  "transactions": [
    {
      "id": "get_pet",
      "status": "success",
      "code": 200,
      "message": "Pet found in the system.",
      "data": {
        "id": 201,
        "name": "Buddy",
        "age": 3,
        "breed": "Labrador Retriever",
        "weight_kg": 28.5,
        "microchip_id": "982000411234567",
        "owner": {
          "id": 1001,
          "name": "John Doe",
          "phone": "+1-555-1234"
        },
        "dietary_preferences": {
          "food_brand": "Hill’s Science Diet",
          "meal_frequency": 2,
          "allergies": ["Chicken", "Soy"]
        }
      }
    },
    {
      "id": "create_pet",
      "status": "skipped",
      "code": 304,
      "message": "Pet already exists. No need to create a new record."
    },
    {
      "id": "order_pet_food",
      "status": "success",
      "code": 201,
      "message": "Pet food order placed successfully.",
      "data": {
        "order_id": 5012,
        "pet_id": 201,
        "store_id": 123,
        "food_brand": "Hill’s Science Diet",
        "quantity_kg": 5,
        "order_date": "2025-02-10T14:30:00Z",
        "status": "Processing",
        "delivery_time": "2025-02-11T10:00:00Z",
        "special_requests": "Grain-free variant if available"
      }
    }
  ]
}

API response: Bad Request (Missing Required Fields)

This is one branch ending in a "bad request" response.

{
  "status": "error",
  "message": "Missing required fields: name, breed"
}

API response: 401 Unauthorized (Invalid API Token)

This is one branch ending in an "unauthorized" response.

{
  "status": "error",
  "message": "Unauthorized. Invalid API token."
}

API response: 409 Conflict (Duplicate Microchip ID)

This is one branch ending in a "conflict" response.

{
  "status": "error",
  "message": "A pet with this microchip ID already exists."
}