License API endpoint
A regulatory authorization the lab works under, such as an animal research approval.
Table of contents
Endpoints
- Private portal:
https://www.brainstem.org/api/private/personal_attributes/license/(needs a token; one record: append<id>/) - Public portal:
https://www.brainstem.org/api/public/personal_attributes/license/(read-only, public projects, no token) - Response keys:
license(detail, create, update),licenses(list) - Permissions: object permissions on the record itself (member / manager / owner roles)
- Deleting: also deletes the linked
licensegroupmembershipinvitation,licensemembershipinvitationrecords
Fields
[required] fields must be sent on create; [read-only] fields are returned but cannot be set. A nestable relation can be traversed in filters (filter{field.other}) and sideloaded with include[]=field.*; other relations can only be compared with ids (filter{field}=<id>). See the query syntax.
| Field | Description |
|---|---|
id | UUID string [read-only] |
name | string [required]; max 255 characters. Name/title of the license (e.g., “PPL: Septo-hippocampal dynamics 2025-2028”) |
type | one of animal_research_authorization, human_research_authorization, biosafety_gmo_authorization, wildlife_fieldwork_permit, controlled_substance_license, chemical_use_authorization, import_export_permit [required]. Type of authorization or license |
status | one of draft, pending, active, suspended, expired, revoked [required]. Current status of the license |
description | string; nullable. Detailed description of the license scope and purpose |
country | string; nullable. Country where the license was issued (ISO country code) |
regulatory_authority | regulatoryauthority id; nullable. Regulatory authority that issued the license (select from standardized list or add new authority in Taxonomies) |
license_number | string; max 128 characters. Official license number on the approval document |
license_document | string; max 100 characters. Upload the official license document as a PDF (10 MB maximum) |
valid_from | date; nullable. Date when the license becomes valid |
valid_until | date; nullable. Date when the license expires |
license_holders | list of user ids. Named license holders (e.g., PIs, authorized personnel) |
behavioralassays | list of behavioralassay ids [read-only]; nullable; nestable |
subjects | list of subject ids [read-only]; nullable; nestable |
procedures | list of procedure ids [read-only]; nullable; nestable |
is_public | boolean. Designates if the license information is publicly available |
created_at | datetime [read-only]; nullable |
updated_at | datetime [read-only] |
users | computed [read-only] |
groups | computed [read-only] |
List
- Allowed portals: private, public
- Request method: GET
- URL:
https://www.brainstem.org/api/private/personal_attributes/license/ - Responses:
200OK;401Not authenticated;403Not allowed
Use example (Python API tool)
resp = client.load('license', load_all=True)
records = resp['licenses']
Use example (MATLAB API tool)
resp = client.load('license', 'load_all', true);
records = resp.licenses;
Response example
{
"licenses": [
{
"id": "<id>",
"name": "License 1",
"type": "animal_research_authorization",
"status": "active",
"description": "",
"country": "",
"regulatory_authority": "<regulatoryauthority-id>",
"license_number": "",
"license_document": "",
"valid_from": "2024-03-22",
"valid_until": "2024-03-22",
"license_holders": [
"<user-id>"
],
"behavioralassays": [
"<behavioralassay-id>"
],
"subjects": [
"<subject-id>"
],
"procedures": [
"<procedure-id>"
],
"is_public": true,
"created_at": "2024-03-22T10:30:00Z",
"updated_at": "2024-03-22T10:30:00Z",
"users": null,
"groups": null
}
],
"meta": {
"page": 1,
"per_page": 100,
"total_results": 1,
"total_pages": 1
}
}
Add
- Allowed portals: private
- Request method: POST
- URL:
https://www.brainstem.org/api/private/personal_attributes/license/ - Data: JSON object with at least the required fields
- Responses:
201Created;400Bad request (validation errors per field);403Not allowed
Use example (Python API tool)
resp = client.save('license', data={"name": "License 1", "type": "animal_research_authorization", "status": "active"})
record = resp.json()['license']
Use example (MATLAB API tool)
created = client.save(struct('name', 'License 1', 'type', 'animal_research_authorization', 'status', 'active'), 'license');
record = created.license;
Detail
- Allowed portals: private, public
- Request method: GET
- URL:
https://www.brainstem.org/api/private/personal_attributes/license/<id>/ - Responses:
200OK;403Not allowed;404Not found
Use example (Python API tool)
resp = client.load('license', id='<id>')
record = resp.json()['license']
Use example (MATLAB API tool)
out = client.load('license', 'id', '<id>');
record = out.license;
Response example
{
"license": {
"id": "<id>",
"name": "License 1",
"type": "animal_research_authorization",
"status": "active",
"description": "",
"country": "",
"regulatory_authority": "<regulatoryauthority-id>",
"license_number": "",
"license_document": "",
"valid_from": "2024-03-22",
"valid_until": "2024-03-22",
"license_holders": [
"<user-id>"
],
"behavioralassays": [
"<behavioralassay-id>"
],
"subjects": [
"<subject-id>"
],
"procedures": [
"<procedure-id>"
],
"is_public": true,
"created_at": "2024-03-22T10:30:00Z",
"updated_at": "2024-03-22T10:30:00Z",
"users": null,
"groups": null
}
}
Change
- Allowed portals: private
- Request method: PATCH
- URL:
https://www.brainstem.org/api/private/personal_attributes/license/<id>/ - Data: JSON object with the fields to change. Lists (
projects,tags, …) and JSON payloads (details, coordinates) are replaced as a whole: read the record first and send the full list or object. - Responses:
200OK;400Bad request;403Not allowed;404Not found
Use example (Python API tool)
resp = client.save('license', id='<id>', data={"name": "License 1 (renamed)"})
Use example (MATLAB API tool)
client.save(struct('id', '<id>', 'name', 'License 1 (renamed)'), 'license', 'method', 'patch');
Delete
- Allowed portals: private
- Request method: DELETE
- URL:
https://www.brainstem.org/api/private/personal_attributes/license/<id>/ - Responses:
204Deleted;400Still referenced by other records;403Not allowed;404Not found
Use example (Python API tool)
resp = client.delete('license', id='<id>')
Use example (MATLAB API tool)
client.delete('<id>', 'license');
Custom actions
| Action | Request |
|---|---|
leave | POST /api/private/personal_attributes/license/<id>/leave/ |
Data model
The fields are described for the web forms on the License data model page.