---
updatedAt: 2026-07-13T06:42:17.000Z
agentTools:
  projectIndex: https://developer.ixon.cloud/llms.txt
---

# Using the API client

Calling the IXON API from inside your Cloud Function.

The API client lets your Cloud Function make requests to any **<Anchor label="IXON API resource" target="_blank" href="https://developer.ixon.cloud/reference">IXON API resource</Anchor>**. It's preconfigured with the correct authentication and authorization, and it automatically targets the company that called the function.

It is accessed through an instance of the `ApiClient` via the `FunctionContext`.

Each method corresponds to an HTTP verb: `get`, `patch`, `post`, `put`, `delete`. Methods return the response body as a Python `dict`.

# Quick example — GET

```python
from ixoncdkingress.function.context import FunctionContext

@FunctionContext.expose
def get_agent(context: FunctionContext, public_id: str) -> dict:
    return context.api_client.get('Agent', {'publicId': public_id})
```

> 🚧 Access scopes
>
> A deployed Cloud Function has an access token that **cannot call IXON API resources by default**. Grant the scopes your function needs under **Studio > Cloud Functions > *your function* > API Access**. This restriction does **not** apply during local development — locally, the function uses the access token from `.accesstoken`.

# Other HTTP methods

Each method takes the resource name and a dict of fields. The exact fields depend on the resource — consult the **<Anchor label="API reference" target="_blank" href="https://developer.ixon.cloud/reference">API reference</Anchor>** for each.

```python
# POST — create a new resource
context.api_client.post('Agent', {
    'name': 'New Agent',
    'description': 'Created from a Cloud Function',
})

# PATCH — partial update
context.api_client.patch('Agent', {
    'publicId': 'RPHHg5LaTtQg',
    'description': 'Updated description',
})

# PUT — full update
context.api_client.put('Agent', {
    'publicId': 'RPHHg5LaTtQg',
    'name': 'Renamed Agent',
    'description': 'Replaced',
    ... more fields ...
})

# DELETE
context.api_client.delete('Agent', {'publicId': 'RPHHg5LaTtQg'})
```

# Listing resources

Most resources expose a list endpoint via their `rel` form (for example `AgentList`) which consists of the name of the endpoint:

```python
@FunctionContext.expose
def list_agents(context: FunctionContext) -> dict:
    return context.api_client.get('AgentList', {})
```

# Downloading a Cloud Function's logs

If your function raises an exception, the Ingress catches it, logs it, and returns an error response to the caller. Logs can be downloaded by navigating to **Studio > Cloud Functions > More options > Download logs**.

# Using a custom API Application ID

By default, the API client uses IXON Cloud's API Application credential. To use your own — typically when you need a specific set of scopes or a separate integration identity — call `set_custom_api_application` before making the request:

```python
@FunctionContext.expose
def with_custom_app(context: FunctionContext) -> dict:
    context.api_client.set_custom_api_application('MY-API-APPLICATION')
    return context.api_client.get('Agent', {'publicId': 'RPHHg5LaTtQg'})
```