---
title: Bank consents (legacy /ofb path)
description: The 5 operations under ofb, as typed calls on the generated REST client.
---

Available from `@codespar/sdk` 0.12.0; the version on npm is 0.16.18. When these docs build, the examples on this page are compiled against `@codespar/sdk` 0.16.18, the version this site installs: a call that does not type-check against it fails the build.

Every call below is `cs.api` reaching one operation of the OpenAPI document this page was generated from; the [REST client overview](/docs/api/sdk/rest-client) explains `request`, `response`, the option bag and the errors. The values are placeholders shaped by the document.

```ts twoslash
import { CodeSpar } from "@codespar/sdk";

const cs = new CodeSpar({ apiKey: process.env.CODESPAR_API_KEY });
```

### POST `/v1/ofb/consents`

<Endpoint method="POST" path="/v1/ofb/consents" deprecated />

Initiate a bank consent (legacy path)

```ts twoslash
import { CodeSpar } from "@codespar/sdk";
const cs = new CodeSpar({ apiKey: "csk_test_0000" });
// ---cut---
const r = await cs.api.response("post", "/v1/ofb/consents", {
  body: {
    bank_id: "bank_0000000000000000",
    consumer_id: "csm_0000000000000000",
    scopes: [
      "string"
    ],
    redirect_url: "https://example.com/hook",
    wallet_id: "wlt_0000000000000000"
  }
});
// r.status is one of the documented statuses (200, 422),
// each with its own body shape in r.data; nothing here throws on 422.
if (r.ok) {
  console.log(r.data);
}
```

Parameters, body and every documented response: [POST /v1/ofb/consents in the HTTP reference](/docs/api/reference/ofb#post-v1ofbconsents).

### GET `/v1/ofb/consents/{id}`

<Endpoint method="GET" path="/v1/ofb/consents/{id}" deprecated />

Read one bank consent

```ts twoslash
import { CodeSpar } from "@codespar/sdk";
const cs = new CodeSpar({ apiKey: "csk_test_0000" });
// ---cut---
const result = await cs.api.get("/v1/ofb/consents/{id}", {
  path: {
    id: "consent_0000000000000000"
  }
});
```

Parameters, body and every documented response: [GET /v1/ofb/consents/\{id\} in the HTTP reference](/docs/api/reference/ofb#get-v1ofbconsentsid).

### POST `/v1/ofb/consents/{id}/callback`

<Endpoint method="POST" path="/v1/ofb/consents/{id}/callback" deprecated />

Finalise a consent after the consumer authorises it (legacy path)

```ts twoslash
import { CodeSpar } from "@codespar/sdk";
const cs = new CodeSpar({ apiKey: "csk_test_0000" });
// ---cut---
const r = await cs.api.response("post", "/v1/ofb/consents/{id}/callback", {
  path: {
    id: "consent_0000000000000000"
  },
  body: {
    auth_code: "string"
  }
});
// r.status is one of the documented statuses (200, 422),
// each with its own body shape in r.data; nothing here throws on 422.
if (r.ok) {
  console.log(r.data);
}
```

Parameters, body and every documented response: [POST /v1/ofb/consents/\{id\}/callback in the HTTP reference](/docs/api/reference/ofb#post-v1ofbconsentsidcallback).

### POST `/v1/ofb/consents/{id}/refresh-statement`

<Endpoint method="POST" path="/v1/ofb/consents/{id}/refresh-statement" deprecated />

Fetch the bank statement and ingest it (legacy path)

```ts twoslash
import { CodeSpar } from "@codespar/sdk";
const cs = new CodeSpar({ apiKey: "csk_test_0000" });
// ---cut---
const r = await cs.api.response("post", "/v1/ofb/consents/{id}/refresh-statement", {
  path: {
    id: "consent_0000000000000000"
  },
  body: {
    since: "2026-01-15T12:00:00.000Z",
    until: "2026-01-15T12:00:00.000Z"
  }
});
// r.status is one of the documented statuses (200, 422),
// each with its own body shape in r.data; nothing here throws on 422.
if (r.ok) {
  console.log(r.data);
}
```

Parameters, body and every documented response: [POST /v1/ofb/consents/\{id\}/refresh-statement in the HTTP reference](/docs/api/reference/ofb#post-v1ofbconsentsidrefresh-statement).

### POST `/v1/ofb/consents/{id}/revoke`

<Endpoint method="POST" path="/v1/ofb/consents/{id}/revoke" deprecated />

Revoke a bank consent (legacy path)

```ts twoslash
import { CodeSpar } from "@codespar/sdk";
const cs = new CodeSpar({ apiKey: "csk_test_0000" });
// ---cut---
const result = await cs.api.post("/v1/ofb/consents/{id}/revoke", {
  path: {
    id: "consent_0000000000000000"
  },
  body: {
    reason: "string"
  }
});
```

Parameters, body and every documented response: [POST /v1/ofb/consents/\{id\}/revoke in the HTTP reference](/docs/api/reference/ofb#post-v1ofbconsentsidrevoke).

