Apply a partial update to a card group's spending constraint
Apply a partial update to a card group’s spending constraint while preserving current properties applied. Properties set to “null” will be removed from the spending constraint.
curl --request PATCH \
--url https://api.slash.com/card-group/{cardGroupId}/spending-constraint \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"merchantCategoryRule": {
"merchantCategories": [
"<string>"
]
},
"merchantRule": {
"merchants": [
"<string>"
]
},
"spendingRule": {
"utilizationLimit": {
"timezone": "<string>",
"startDate": "<string>"
},
"transactionSizeLimit": {}
},
"countryRule": {
"countries": [
"<string>"
]
},
"merchantCategoryCodeRule": {
"merchantCategoryCodes": [
"<string>"
]
}
}
'const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
merchantCategoryRule: {merchantCategories: ['<string>']},
merchantRule: {merchants: ['<string>']},
spendingRule: {
utilizationLimit: {timezone: '<string>', startDate: '<string>'},
transactionSizeLimit: {}
},
countryRule: {countries: ['<string>']},
merchantCategoryCodeRule: {merchantCategoryCodes: ['<string>']}
})
};
fetch('https://api.slash.com/card-group/{cardGroupId}/spending-constraint', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.slash.com/card-group/{cardGroupId}/spending-constraint"
payload = {
"merchantCategoryRule": { "merchantCategories": ["<string>"] },
"merchantRule": { "merchants": ["<string>"] },
"spendingRule": {
"utilizationLimit": {
"timezone": "<string>",
"startDate": "<string>"
},
"transactionSizeLimit": {}
},
"countryRule": { "countries": ["<string>"] },
"merchantCategoryCodeRule": { "merchantCategoryCodes": ["<string>"] }
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.slash.com/card-group/{cardGroupId}/spending-constraint"
payload := strings.NewReader("{\n \"merchantCategoryRule\": {\n \"merchantCategories\": [\n \"<string>\"\n ]\n },\n \"merchantRule\": {\n \"merchants\": [\n \"<string>\"\n ]\n },\n \"spendingRule\": {\n \"utilizationLimit\": {\n \"timezone\": \"<string>\",\n \"startDate\": \"<string>\"\n },\n \"transactionSizeLimit\": {}\n },\n \"countryRule\": {\n \"countries\": [\n \"<string>\"\n ]\n },\n \"merchantCategoryCodeRule\": {\n \"merchantCategoryCodes\": [\n \"<string>\"\n ]\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"merchantCategoryRule": {
"merchantCategories": [
"<string>"
],
"restriction": "allowlist"
},
"merchantRule": {
"merchants": [
"<string>"
],
"restriction": "allowlist"
},
"spendingRule": {
"utilizationLimit": {
"limitAmount": {
"amountCents": 123
},
"preset": "daily",
"timezone": "<string>",
"startDate": "<string>"
},
"transactionSizeLimit": {
"minimum": {
"amountCents": 123
},
"maximum": {
"amountCents": 123
}
}
},
"countryRule": {
"countries": [
"<string>"
],
"restriction": "allowlist"
},
"merchantCategoryCodeRule": {
"merchantCategoryCodes": [
"<string>"
],
"restriction": "allowlist"
}
}{
"message": "<string>",
"name": "<string>",
"identifier": "<string>",
"rawStatus": 123,
"meta": {}
}{
"message": "<string>",
"name": "<string>",
"identifier": "<string>",
"rawStatus": 123,
"meta": {}
}{
"message": "<string>",
"name": "<string>",
"identifier": "<string>",
"rawStatus": 123,
"meta": {}
}{
"message": "<string>",
"name": "<string>",
"identifier": "<string>",
"rawStatus": 123,
"meta": {}
}Authorizations
API key authentication for public API requests.
Keys come in two flavors:
- Legal-entity-scoped keys are pinned to a single legal entity. Minted via the dashboard under a specific entity; every request acts on that entity.
- User-scoped keys are pinned to a user and span every legal
entity that user has access to. Every request made with a
user-scoped key (except
GET /legal-entity, which lists the legal entities the user can access) must include anx-legal-entityheader naming the legal entity the request is operating on. Requests without the header are rejected with400. The authenticated user must have an active permission role on the supplied legal entity, otherwise the request is rejected with403.
Path Parameters
Body
A partial spending constraint update that can be applied to a CardGroupSpendingRule
Hide child attributes
Hide child attributes
Hide child attributes
Hide child attributes
Canonical IANA timezone identifier in Area/Location form, for example America/New_York, Asia/Shanghai or Asia/Hong_Kong. Limits always reset at midnight in the timezone specified. If no timezone is specified, UTC is used. Values that are not valid IANA identifiers are rejected with a 400 -- this includes language-level enum names such as ASIA_SHANGHAI, bare UTC offsets such as +8, and abbreviations such as PST. Note that some languages return the enum constant rather than the IANA id by default (for example Java/Kotlin ZoneId .name() instead of .getId()).
daily, weekly, monthly, yearly, collective Format ISO-8601. A day that equals today or the past. This is optional.If the preset is "daily", this value is ignored. If the preset is "weekly", "monthly" or "yearly", then the this value is used to compute when the limit should start limit.
Hide child attributes
Hide child attributes
Response
OK
A constraint that can be applied to a CardGroupSpendingRule
Hide child attributes
Hide child attributes
Hide child attributes
Hide child attributes
daily, weekly, monthly, yearly, collective Canonical IANA timezone identifier in Area/Location form, for example America/New_York, Asia/Shanghai or Asia/Hong_Kong. Limits always reset at midnight in the timezone specified. If no timezone is specified, UTC is used. Values that are not valid IANA identifiers are rejected with a 400 -- this includes language-level enum names such as ASIA_SHANGHAI, bare UTC offsets such as +8, and abbreviations such as PST. Note that some languages return the enum constant rather than the IANA id by default (for example Java/Kotlin ZoneId .name() instead of .getId()).
Format ISO-8601. A day that equals today or the past. This is optional.If the preset is "daily", this value is ignored. If the preset is "weekly", "monthly" or "yearly", then the this value is used to compute when the limit should start limit.
Hide child attributes
Hide child attributes
curl --request PATCH \
--url https://api.slash.com/card-group/{cardGroupId}/spending-constraint \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"merchantCategoryRule": {
"merchantCategories": [
"<string>"
]
},
"merchantRule": {
"merchants": [
"<string>"
]
},
"spendingRule": {
"utilizationLimit": {
"timezone": "<string>",
"startDate": "<string>"
},
"transactionSizeLimit": {}
},
"countryRule": {
"countries": [
"<string>"
]
},
"merchantCategoryCodeRule": {
"merchantCategoryCodes": [
"<string>"
]
}
}
'const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
merchantCategoryRule: {merchantCategories: ['<string>']},
merchantRule: {merchants: ['<string>']},
spendingRule: {
utilizationLimit: {timezone: '<string>', startDate: '<string>'},
transactionSizeLimit: {}
},
countryRule: {countries: ['<string>']},
merchantCategoryCodeRule: {merchantCategoryCodes: ['<string>']}
})
};
fetch('https://api.slash.com/card-group/{cardGroupId}/spending-constraint', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.slash.com/card-group/{cardGroupId}/spending-constraint"
payload = {
"merchantCategoryRule": { "merchantCategories": ["<string>"] },
"merchantRule": { "merchants": ["<string>"] },
"spendingRule": {
"utilizationLimit": {
"timezone": "<string>",
"startDate": "<string>"
},
"transactionSizeLimit": {}
},
"countryRule": { "countries": ["<string>"] },
"merchantCategoryCodeRule": { "merchantCategoryCodes": ["<string>"] }
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.slash.com/card-group/{cardGroupId}/spending-constraint"
payload := strings.NewReader("{\n \"merchantCategoryRule\": {\n \"merchantCategories\": [\n \"<string>\"\n ]\n },\n \"merchantRule\": {\n \"merchants\": [\n \"<string>\"\n ]\n },\n \"spendingRule\": {\n \"utilizationLimit\": {\n \"timezone\": \"<string>\",\n \"startDate\": \"<string>\"\n },\n \"transactionSizeLimit\": {}\n },\n \"countryRule\": {\n \"countries\": [\n \"<string>\"\n ]\n },\n \"merchantCategoryCodeRule\": {\n \"merchantCategoryCodes\": [\n \"<string>\"\n ]\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"merchantCategoryRule": {
"merchantCategories": [
"<string>"
],
"restriction": "allowlist"
},
"merchantRule": {
"merchants": [
"<string>"
],
"restriction": "allowlist"
},
"spendingRule": {
"utilizationLimit": {
"limitAmount": {
"amountCents": 123
},
"preset": "daily",
"timezone": "<string>",
"startDate": "<string>"
},
"transactionSizeLimit": {
"minimum": {
"amountCents": 123
},
"maximum": {
"amountCents": 123
}
}
},
"countryRule": {
"countries": [
"<string>"
],
"restriction": "allowlist"
},
"merchantCategoryCodeRule": {
"merchantCategoryCodes": [
"<string>"
],
"restriction": "allowlist"
}
}{
"message": "<string>",
"name": "<string>",
"identifier": "<string>",
"rawStatus": 123,
"meta": {}
}{
"message": "<string>",
"name": "<string>",
"identifier": "<string>",
"rawStatus": 123,
"meta": {}
}{
"message": "<string>",
"name": "<string>",
"identifier": "<string>",
"rawStatus": 123,
"meta": {}
}{
"message": "<string>",
"name": "<string>",
"identifier": "<string>",
"rawStatus": 123,
"meta": {}
}