> ## Documentation Index
> Fetch the complete documentation index at: https://docs.skyvexsoftware.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ctx.airline

> The bound airline and a refresh-aware HTTP client, from a background module.

`ctx.airline` (`PluginAirlineAccessor`) gives read-only access to the currently-bound airline plus a pre-configured HTTP client. See [`PluginAirlineAccessor`](/sdk/type-reference#pluginairlineaccessor) and [`PluginAirline`](/sdk/type-reference#pluginairline) for the full shapes.

## `getCurrent()`

Returns the current airline binding. Re-call it when you need a fresh snapshot — there's no event subscription.

```ts theme={null}
const airline = await ctx.airline.getCurrent();
ctx.logger.info("MyPlugin", `Bound to ${airline.id} at ${airline.baseUrl}`);
```

## `createClient()` — recommended

Returns an [axios](https://axios-http.com/) instance pre-configured for the bound airline:

* `baseURL` is set to `airline.baseUrl` (resolved per request).
* `Authorization` header carries the current VA bearer.
* On a `401` response, the shell exchanges the stored refresh token at the VA's `refresh_url`. If refresh succeeds, the request is retried exactly once. If the VA didn't configure a `refresh_url`, the user has no refresh token, or the VA rejected the refresh, the `401` propagates and the shell's existing re-auth flow takes over.

Cache the returned instance for the lifetime of the background module — it's safe to reuse across requests.

```ts theme={null}
import { createPlugin } from "@skyvexsoftware/stratos-sdk/helpers";

export default createPlugin({
  async onStart(ctx) {
    const va = ctx.airline.createClient();

    // Same axios API plugins use in the renderer via useVaApi():
    const { data } = await va.get<{ pilotID: string }>("/pilot/verify");
    ctx.logger.info("MyPlugin", `Verified ${data.pilotID}`);

    await va.post("/pireps", {
      flight_number: "QFA1",
      arrival: "EGLL",
    });
  },

  async onStop() {
    // axios instances don't need explicit teardown
  },
});
```

**When to use it:** any time your background module calls the airline's backend. `createClient()` is the recommended path (refresh handling for free); reach for `getCurrent()` when you only need the airline's identity or base URL. The renderer-side equivalent is [`useVaApi()`](/sdk/hooks/use-va-api).
