Skip to main content
REST client

Payables

The 14 operations under payables, as typed calls on the generated REST client.

2 min read
View MarkdownEdit on GitHub

Available from @codespar/sdk 0.12.0; the version on npm is 0.16.23. When these docs build, the examples on this page are compiled against @codespar/sdk 0.16.23, 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 explains request, response, the option bag and the errors. The values are placeholders shaped by the document.

import {  } from "@codespar/sdk";

const  = new ({ : .. });

GET /v1/payables

List payables

const  = await ..("/v1/payables");

Parameters, body and every documented response: GET /v1/payables in the HTTP reference.

POST /v1/payables

Create a payable from a partner's record or a person's form

const  = await ..("post", "/v1/payables", {
  : {
    : "payable.v1",
    : "invoice",
    : {
      : "upload",
      : "credential_0000000000000000",
      : "conn_0000000000000000",
      : "string"
    },
    : "string",
    : {
      : {
        : "string",
        : "parser_local",
        : {
          : 0,
          : "string",
          : "verified"
        },
        : 0
      },
      : {
        : "string",
        : "parser_local",
        : {
          : 0,
          : "string",
          : "verified"
        },
        : 0
      }
    },
    : {
      : {
        : "string",
        : "parser_local",
        : {
          : 0,
          : "string",
          : "verified"
        },
        : 0
      },
      : {
        : "string",
        : "parser_local",
        : {
          : 0,
          : "string",
          : "verified"
        },
        : 0
      }
    },
    : {
      : "string",
      : "parser_local",
      : {
        : 0,
        : "string",
        : "verified"
      },
      : 0
    },
    : {
      : "string",
      : "parser_local",
      : {
        : 0,
        : "string",
        : "verified"
      },
      : 0
    },
    : {
      : "2026-01-15",
      : "parser_local",
      : {
        : 0,
        : "string",
        : "verified"
      },
      : 0
    },
    : {
      : "2026-01-15",
      : "parser_local",
      : {
        : 0,
        : "string",
        : "verified"
      },
      : 0
    },
    : [
      {
        : {
          : "string",
          : "parser_local",
          : {
            : 0,
            : "string",
            : "verified"
          },
          : 0
        },
        : {
          : 1000,
          : "parser_local",
          : {
            : 0,
            : "string",
            : "verified"
          },
          : 0
        },
        : {
          : 1000,
          : "parser_local",
          : {
            : 0,
            : "string",
            : "verified"
          },
          : 0
        },
        : {
          : 1000,
          : "parser_local",
          : {
            : 0,
            : "string",
            : "verified"
          },
          : 0
        }
      }
    ],
    : {
      : {
        : 1000,
        : "parser_local",
        : {
          : 0,
          : "string",
          : "verified"
        },
        : 0
      },
      : {
        : 1000,
        : "parser_local",
        : {
          : 0,
          : "string",
          : "verified"
        },
        : 0
      },
      : {
        : 1000,
        : "parser_local",
        : {
          : 0,
          : "string",
          : "verified"
        },
        : 0
      },
      : {
        : 1000,
        : "parser_local",
        : {
          : 0,
          : "string",
          : "verified"
        },
        : 0
      },
      : {
        : 1000,
        : "parser_local",
        : {
          : 0,
          : "string",
          : "verified"
        },
        : 0
      },
      : {
        : 1000,
        : "parser_local",
        : {
          : 0,
          : "string",
          : "verified"
        },
        : 0
      },
      : {
        : 1000,
        : "parser_local",
        : {
          : 0,
          : "string",
          : "verified"
        },
        : 0
      },
      : {
        : 1000,
        : "parser_local",
        : {
          : 0,
          : "string",
          : "verified"
        },
        : 0
      },
      : {
        : 1000,
        : "parser_local",
        : {
          : 0,
          : "string",
          : "verified"
        },
        : 0
      },
      : {
        : "string",
        : "parser_local",
        : {
          : 0,
          : "string",
          : "verified"
        },
        : 0
      }
    },
    : {
      : "string",
      : "string",
      : "string"
    },
    : {
      : "string",
      : "string",
      : 0,
      : 0,
      : 0
    }
  }
});
// 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 (.) {
  .(.);
}

Parameters, body and every documented response: POST /v1/payables in the HTTP reference.

POST /v1/payables/batches

Create a batch of payables from files and items

const  = await ..("post", "/v1/payables/batches", {
  : {
    "Idempotency-Key": "string"
  },
  : {
    : [
      "string"
    ],
    : [
      {
        : "string",
        : "string",
        : "string",
        : 1000,
        : "string",
        : "string"
      }
    ],
    : "api",
    : "conversation_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 (.) {
  .(.);
}

Parameters, body and every documented response: POST /v1/payables/batches in the HTTP reference.

GET /v1/payables/batches/{batchId}

Read a batch, its items and their results

const  = await ..("/v1/payables/batches/{batchId}", {
  : {
    : "batch_0000000000000000"
  }
});

Parameters, body and every documented response: GET /v1/payables/batches/{batchId} in the HTTP reference.

POST /v1/payables/batches/{batchId}/items

Add files or items to an open batch

const  = await ..("post", "/v1/payables/batches/{batchId}/items", {
  : {
    : "batch_0000000000000000"
  },
  : {
    : 0,
    : [
      "string"
    ],
    : [
      {
        : "string",
        : "string",
        : "string",
        : 1000,
        : "string",
        : "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 (.) {
  .(.);
}

Parameters, body and every documented response: POST /v1/payables/batches/{batchId}/items in the HTTP reference.

PATCH /v1/payables/batches/{batchId}/items/{itemId}

Complement, correct, choose the way or exclude one item

const  = await ..("patch", "/v1/payables/batches/{batchId}/items/{itemId}", {
  : {
    : "batch_0000000000000000",
    : "item_0000000000000000"
  },
  : {
    : 0,
    : 1000,
    : "string",
    : "string",
    : "string",
    : "string",
    : true,
    : "pix"
  }
});
// 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 (.) {
  .(.);
}

Parameters, body and every documented response: PATCH /v1/payables/batches/{batchId}/items/{itemId} in the HTTP reference.

POST /v1/payables/batches/{batchId}/pay

POST/v1/payables/batches/{batchId}/pay
Moves money

pays every payable item through the governed consumer-payment cycle

Confirm the exact list and pay it

const  = await ..("post", "/v1/payables/batches/{batchId}/pay", {
  : {
    : "batch_0000000000000000"
  },
  : {
    "Idempotency-Key": "string"
  },
  : {
    : 0,
    : "string",
    : "mandate_0000000000000000"
  }
});
// r.status is one of the documented statuses (200, 403, 422),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

The gates that refuse this call, the meaning of each refusal, parameters and every documented response: POST /v1/payables/batches/{batchId}/pay in the HTTP reference.

GET /v1/payables/counts

Count the payables waiting for a person

const  = await ..("/v1/payables/counts");

Parameters, body and every documented response: GET /v1/payables/counts in the HTTP reference.

POST /v1/payables/documents

Create a payable from an uploaded document (PDF or image)

const  = await ..("post", "/v1/payables/documents", {
  : {
    : "string",
    : "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 (.) {
  .(.);
}

Parameters, body and every documented response: POST /v1/payables/documents in the HTTP reference.

POST /v1/payables/files

Upload a document or a spreadsheet of payables

const  = await ..("post", "/v1/payables/files", {
  : {
    : "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 (.) {
  .(.);
}

Parameters, body and every documented response: POST /v1/payables/files in the HTTP reference.

POST /v1/payables/files/authorizations

Authorize a browser to upload files straight to the API

const  = await ..("/v1/payables/files/authorizations", {
  : {}
});

Parameters, body and every documented response: POST /v1/payables/files/authorizations in the HTTP reference.

GET /v1/payables/{payableId}

Read a payable

const  = await ..("/v1/payables/{payableId}", {
  : {
    : "payable_0000000000000000"
  }
});

Parameters, body and every documented response: GET /v1/payables/{payableId} in the HTTP reference.

POST /v1/payables/{payableId}/pay

POST/v1/payables/{payableId}/pay
Moves money

Pays a `READY` payable through the governed consumer-payment cycle

Pay a payable under a consumer mandate

const  = await ..("post", "/v1/payables/{payableId}/pay", {
  : {
    : "payable_0000000000000000"
  },
  : {
    : "mandate_0000000000000000"
  }
});
// r.status is one of the documented statuses (200, 403, 422),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

The gates that refuse this call, the meaning of each refusal, parameters and every documented response: POST /v1/payables/{payableId}/pay in the HTTP reference.

POST /v1/payables/{payableId}/review

Complete the review of a payable

const  = await ..("post", "/v1/payables/{payableId}/review", {
  : {
    : "payable_0000000000000000"
  },
  : {
    : []
  }
});
// r.status is one of the documented statuses (200, 403, 422),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

Parameters, body and every documented response: POST /v1/payables/{payableId}/review in the HTTP reference.

Payables | CodeSpar