# Providers

## Create

```c
/// Initialize Vertices SDK
/// \param config Pass the configuration such as providers and user-defined event handler
/// \return
ret_code_t
vertices_new(vertex_t *config);
```

### Parameters

* `config` pointer to config.

```c
typedef struct
{
    provider_info_t *provider;
    ret_code_t (*vertices_evt_handler)(vtc_evt_t *evt);
} vertex_t;

typedef struct
{
    char *url;
    short port;
    char *header;
    const char *cert_pem;
} provider_info_t;
```

Here is an example of configuration for a node (`algod`) running locally on my machine. Comments give a configuration with Algoexplorer's API.

```c
static provider_info_t providers =
    {
        .url = (char *) "localhost", // or "https://api.testnet.algoexplorer.io"
        .port = 8080, // 0
        .header = (char *) "X-Algo-API-Token:<api-token>" // ""
        .cert_pem = algoexplorer_root_cert_pem_start
    };
```

```c
static vertex_t m_vertex = {
    .provider = &providers,
    .vertices_evt_handler = vertices_evt_handler
};
```

### Return codes

* `VTC_SUCCESS` on success
* `VTC_ERROR_INTERNAL` if HTTP client cannot be initialized

## Health

```c
ret_code_t
vertices_ping(void);
```

### Return codes

* `VTC_SUCCESS` when API can be reached
* `VTC_HTTP_ERROR` when an error occurs

## Version

```c
ret_code_t
vertices_version(provider_version_t *version);
```

### Parameters

Pointer to `provider_version_t` structure that will be filled by the function.

### Return codes

* `VTC_SUCCESS` when `version` has been filled with node info
* `VTC_ERROR_OFFLINE` when node cannot be reached to get info. Version could still be filled with information from a previous call.

�


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.vertices.network/vertices-sdk/api-reference/providers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
