Set a project's storage rules
curl --request PUT \
--url https://app.hookie.ai/admin/api/projects/{project_id}/storage-rules \
--header 'Content-Type: application/json' \
--data '
{
"revision": 1,
"rules": {
"version": 1,
"memory": {
"kinds": [],
"min_tags": 10,
"require_thread": true,
"title_min": 100,
"title_max": 100,
"max_content_chars": 16384
},
"document": {
"kinds": [],
"content_types": [],
"max_bytes": 5242880,
"require_source_ref": true
}
}
}
'const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
revision: 1,
rules: {
version: 1,
memory: {
kinds: [],
min_tags: 10,
require_thread: true,
title_min: 100,
title_max: 100,
max_content_chars: 16384
},
document: {kinds: [], content_types: [], max_bytes: 5242880, require_source_ref: true}
}
})
};
fetch('https://app.hookie.ai/admin/api/projects/{project_id}/storage-rules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.hookie.ai/admin/api/projects/{project_id}/storage-rules"
payload = {
"revision": 1,
"rules": {
"version": 1,
"memory": {
"kinds": [],
"min_tags": 10,
"require_thread": True,
"title_min": 100,
"title_max": 100,
"max_content_chars": 16384
},
"document": {
"kinds": [],
"content_types": [],
"max_bytes": 5242880,
"require_source_ref": True
}
}
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text){
"project_id": "<string>",
"applies_to": "agents",
"rules": {
"version": 1,
"memory": {
"kinds": [
"memory"
],
"min_tags": 10,
"require_thread": true,
"title_min": 100,
"title_max": 100,
"max_content_chars": 16384
},
"document": {
"kinds": [
"prd"
],
"content_types": [
"text/plain"
],
"max_bytes": 5242880,
"require_source_ref": true
}
},
"effective": {
"memory": {
"kinds": [
"memory"
],
"min_tags": 10,
"require_thread": true,
"title_min": 100,
"title_max": 100,
"max_content_chars": 16384
},
"document": {
"kinds": [
"prd"
],
"content_types": [
"text/plain"
],
"max_bytes": 5242880,
"require_source_ref": true
}
},
"revision": 1,
"updated_by": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
}Projects
Set a project's storage rules
Set the rules (#689), replacing the whole rule set. Rules only tighten the system limits: a value looser than one (a title over 200 characters, content over 32,768 characters, more than 20 tags, a file over 10 MiB, a kind or file type the system does not have) and any unknown key are refused with 400. revision is the revision you read: 0 creates the rules, and a mismatch is 409 (code storage_rules_changed). Needs the manage role in the project, and a person: an agent, an Agent Registration or an API key is refused with 403 at every scope. Audited as project_updated with the rules before and after.
PUT
/
admin
/
api
/
projects
/
{project_id}
/
storage-rules
Set a project's storage rules
curl --request PUT \
--url https://app.hookie.ai/admin/api/projects/{project_id}/storage-rules \
--header 'Content-Type: application/json' \
--data '
{
"revision": 1,
"rules": {
"version": 1,
"memory": {
"kinds": [],
"min_tags": 10,
"require_thread": true,
"title_min": 100,
"title_max": 100,
"max_content_chars": 16384
},
"document": {
"kinds": [],
"content_types": [],
"max_bytes": 5242880,
"require_source_ref": true
}
}
}
'const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
revision: 1,
rules: {
version: 1,
memory: {
kinds: [],
min_tags: 10,
require_thread: true,
title_min: 100,
title_max: 100,
max_content_chars: 16384
},
document: {kinds: [], content_types: [], max_bytes: 5242880, require_source_ref: true}
}
})
};
fetch('https://app.hookie.ai/admin/api/projects/{project_id}/storage-rules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.hookie.ai/admin/api/projects/{project_id}/storage-rules"
payload = {
"revision": 1,
"rules": {
"version": 1,
"memory": {
"kinds": [],
"min_tags": 10,
"require_thread": True,
"title_min": 100,
"title_max": 100,
"max_content_chars": 16384
},
"document": {
"kinds": [],
"content_types": [],
"max_bytes": 5242880,
"require_source_ref": True
}
}
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text){
"project_id": "<string>",
"applies_to": "agents",
"rules": {
"version": 1,
"memory": {
"kinds": [
"memory"
],
"min_tags": 10,
"require_thread": true,
"title_min": 100,
"title_max": 100,
"max_content_chars": 16384
},
"document": {
"kinds": [
"prd"
],
"content_types": [
"text/plain"
],
"max_bytes": 5242880,
"require_source_ref": true
}
},
"effective": {
"memory": {
"kinds": [
"memory"
],
"min_tags": 10,
"require_thread": true,
"title_min": 100,
"title_max": 100,
"max_content_chars": 16384
},
"document": {
"kinds": [
"prd"
],
"content_types": [
"text/plain"
],
"max_bytes": 5242880,
"require_source_ref": true
}
},
"revision": 1,
"updated_by": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
}Body
application/json
Response
The rules as saved