API reference · Credit Limit

Set or Update Credit Limit for Customer

POSThttps://api.sandbox.cws.digital/creditLimit/save

Description

Creates or updates a customer's credit limit for one of your store's types, created in Create Credit Limit Type. Resending for the same customer and type updates the existing limit.

All six fields are required. 0 and false are valid values; only null and empty text count as missing.

To send several customers at once, use Set or Update Credit Limits in Batch.

The examples use the CREDITO-PADRAO type, the same one as in the example of Create Credit Limit Type: create it first in your store.

Request body

Content-Typeapplication/jsonRequired
Edit the body with
FieldTypeRequiredDescriptionValue
documentstringYes

Customer's CPF or CNPJ, with or without mask. Up to 18 characters.

credit_codestringYes

Code of the limit type — the code you defined when creating the type. Up to 18 characters.

valuenumberYes

Total value of the limit.

balancenumberYes

Available balance. It replaces the stored balance; see The balance sent replaces the current balance.

activebooleanYes

true keeps the limit active; false leaves the limit inactive.

without_credit_limitbooleanYes

true allows the customer to buy even without balance.

Business rules

The balance sent replaces the current balance

value is the limit and balance is the available balance. Both replace what is stored.

Purchases with the limit deduct from the balance. Resending an old balance undoes these deductions: always send the current balance from your system.

Without changes, nothing is stored

Resending the same values responds 200 with the limit as it is, without storing anything.

Document with or without mask

document accepts CPF or CNPJ, with or without mask, including the CNPJ with letters. The response brings the document with letters and digits only.

Responses

  • 401

    Missing, malformed or expired token.

Try it

Sandbox

Language

Credentials

Access token: saved in this tab and used on every endpoint.

Each token only reaches the partner's own data and that of the branches with an authorized link.

Don't have sandbox credentials yet? See how to request them

Request

cURL
curl --request POST \
  --url 'https://api.sandbox.cws.digital/creditLimit/save' \
  --header 'Authorization: Bearer <access_token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "document": "57.578.030/0001-05",
  "credit_code": "CREDITO-PADRAO",
  "value": 5000,
  "balance": 5000,
  "active": true,
  "without_credit_limit": false
}'

Response

Click Try it to see the real response here, or pick a documented example: