Consumers
Generated HTTP reference for the 5 operations the published OpenAPI document describes under consumers.
Consumers
This page is generated from the published OpenAPI document. It is complete with respect to that document and says nothing about surfaces the document does not describe yet. See what is generated here for what that means.
Base URL: https://api.codespar.dev
Every operation below requires a Bearer token. See Authentication.
GET /v1/consumers
https://api.codespar.dev/v1/consumersList titulars
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
limit | integer | no | — |
verified | "true" | "false" | no | — |
Responses
| Status | Body | Description |
|---|---|---|
200 | object | OK |
400 | object | Bad Request — the body or query did not match the schema. |
Response 200
| Field | Type | Required | Description |
|---|---|---|---|
consumers | array of object | yes | — |
curl -X GET https://api.codespar.dev/v1/consumers \
-H "Authorization: Bearer $CODESPAR_API_KEY"const res = await fetch("https://api.codespar.dev/v1/consumers", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.CODESPAR_API_KEY}`,
},
});
const data = await res.json();{
"consumers": [
{
"id": "obj_0000000000000000",
"metadata": {},
"status": "unverified",
"created_at": "string"
}
]
}POST /v1/consumers
https://api.codespar.dev/v1/consumersCreate the titular, without a document
Request body
| Field | Type | Required | Description |
|---|---|---|---|
display_name | string | no | — |
metadata | object | no | — |
Responses
| Status | Body | Description |
|---|---|---|
201 | object | OK |
400 | object | Bad Request — the body or query did not match the schema. |
Response 201
| Field | Type | Required | Description |
|---|---|---|---|
created_at | string | yes | — |
display_name | string,null | yes | — |
document | string,null | yes | — |
document_source | string,null | yes | — |
document_verified_at | string,null | yes | — |
id | string | yes | — |
metadata | object | yes | — |
person_type | string,null | yes | — |
status | "unverified" | "verified" | yes | — |
tax_type | string,null | yes | — |
curl -X POST https://api.codespar.dev/v1/consumers \
-H "Authorization: Bearer $CODESPAR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"display_name": "Example",
"metadata": {}
}'const res = await fetch("https://api.codespar.dev/v1/consumers", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.CODESPAR_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"display_name": "Example",
"metadata": {}
}),
});
const data = await res.json();{
"id": "obj_0000000000000000",
"metadata": {},
"status": "unverified",
"created_at": "string"
}GET /v1/consumers/{id}
https://api.codespar.dev/v1/consumers/{id}Read one titular, with the ids of what hangs off it
Responses
| Status | Body | Description |
|---|---|---|
200 | object | OK |
404 | object | Not Found |
Response 200
| Field | Type | Required | Description |
|---|---|---|---|
created_at | string | yes | — |
display_name | string,null | yes | — |
document | string,null | yes | — |
document_source | string,null | yes | — |
document_verified_at | string,null | yes | — |
id | string | yes | — |
metadata | object | yes | — |
person_type | string,null | yes | — |
status | "unverified" | "verified" | yes | — |
tax_type | string,null | yes | — |
curl -X GET https://api.codespar.dev/v1/consumers/{id} \
-H "Authorization: Bearer $CODESPAR_API_KEY"const res = await fetch("https://api.codespar.dev/v1/consumers/{id}", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.CODESPAR_API_KEY}`,
},
});
const data = await res.json();{
"id": "obj_0000000000000000",
"metadata": {},
"status": "unverified",
"created_at": "string"
}PATCH /v1/consumers/{id}
https://api.codespar.dev/v1/consumers/{id}Update the mutable fields of a titular
Request body
| Field | Type | Required | Description |
|---|---|---|---|
display_name | string,null | no | — |
metadata | object | no | — |
tax_type | "PJ" | "MEI" | "ME" | "PF" | no | — |
Responses
| Status | Body | Description |
|---|---|---|
200 | object | OK |
400 | object | Bad Request — the body or query did not match the schema. |
404 | object | Not Found |
Response 200
| Field | Type | Required | Description |
|---|---|---|---|
created_at | string | yes | — |
display_name | string,null | yes | — |
document | string,null | yes | — |
document_source | string,null | yes | — |
document_verified_at | string,null | yes | — |
id | string | yes | — |
metadata | object | yes | — |
person_type | string,null | yes | — |
status | "unverified" | "verified" | yes | — |
tax_type | string,null | yes | — |
curl -X PATCH https://api.codespar.dev/v1/consumers/{id} \
-H "Authorization: Bearer $CODESPAR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"metadata": {},
"tax_type": "PJ"
}'const res = await fetch("https://api.codespar.dev/v1/consumers/{id}", {
method: "PATCH",
headers: {
Authorization: `Bearer ${process.env.CODESPAR_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"metadata": {},
"tax_type": "PJ"
}),
});
const data = await res.json();{
"id": "obj_0000000000000000",
"metadata": {},
"status": "unverified",
"created_at": "string"
}GET /v1/consumers/{id}/wallet
https://api.codespar.dev/v1/consumers/{id}/walletThe consumer's unified wallet, rolled up per currency
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | yes | — |
Responses
| Status | Body | Description |
|---|---|---|
200 | object | OK |
Response 200
| Field | Type | Required | Description |
|---|---|---|---|
consumer_id | string | yes | — |
currencies | array of object | yes | — |
curl -X GET https://api.codespar.dev/v1/consumers/{id}/wallet \
-H "Authorization: Bearer $CODESPAR_API_KEY"const res = await fetch("https://api.codespar.dev/v1/consumers/{id}/wallet", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.CODESPAR_API_KEY}`,
},
});
const data = await res.json();{
"consumer_id": "csm_0000000000000000",
"currencies": [
{
"currency": "BRL",
"authorized_minor": 1,
"spent_minor": 1,
"available_minor": 1,
"funding_source_ids": [
"string"
],
"mandate_ids": [
"string"
]
}
]
}