> For the complete documentation index, see [llms.txt](https://guide.fariaedu.com/integrations-portal/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://guide.fariaedu.com/integrations-portal/schoolsbuddy/public-rest-apis/subject.md).

# Subject

## GET /api/v1/Groups/Subject

> Gets a paginated list of Subjects for the calling organisation(s),> \
> sorted by id. Archived Subjects are added when includeArchived is true.

```json
{"openapi":"3.0.1","info":{"title":"SchoolsBuddy Public API","version":"1.0"},"servers":[{"url":"https://publicapi-eu.schoolsbuddy.net","description":"EMEA Public Api server"},{"url":"https://publicapi-asia.schoolsbuddy.net","description":"Asia Public Api server"},{"url":"https://publicapi-us.schoolsbuddy.net","description":"US Public Api server"},{"url":"https://publicapi.schoolsbuddy.cn","description":"China Public Api server"},{"url":"https://identity-eu.schoolsbuddy.net","description":"EMEA Identity server"},{"url":"https://identity-asia.schoolsbuddy.net","description":"Asia Identity server"},{"url":"https://identity-us.schoolsbuddy.net","description":"US Identity server"},{"url":"https://accounts.schoolsbuddy.cn","description":"China Identity server"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"apiKey","description":"Type \"Bearer\" followed by a space and a token.","name":"Authorization","in":"header"}},"schemas":{"SubjectResponseDtoListPagedSubjectFilterResponseDto":{"type":"object","properties":{"isSuccess":{"type":"boolean"},"errors":{"type":"array","items":{"type":"string"},"nullable":true},"messageTranslationParameters":{"nullable":true},"data":{"type":"array","items":{"$ref":"#/components/schemas/SubjectResponseDto"},"nullable":true},"pageNumber":{"type":"integer","format":"int32"},"pageSize":{"type":"integer","format":"int32"},"firstPage":{"type":"string","format":"uri","nullable":true},"lastPage":{"type":"string","format":"uri","nullable":true},"totalPages":{"type":"integer","format":"int32"},"totalRecords":{"type":"integer","format":"int32"},"nextPage":{"type":"string","format":"uri","nullable":true},"previousPage":{"type":"string","format":"uri","nullable":true},"baseUri":{"type":"string","format":"uri","nullable":true},"searchParameters":{"type":"array","items":{"$ref":"#/components/schemas/StringStringKeyValuePair"},"nullable":true}},"additionalProperties":false},"SubjectResponseDto":{"type":"object","properties":{"id":{"type":"integer","format":"int32"},"organisationId":{"type":"integer","format":"int32"},"name":{"type":"string","nullable":true},"isArchived":{"type":"boolean"},"createdAtUtc":{"type":"string","format":"date-time"},"updatedAtUtc":{"type":"string","format":"date-time"},"thirdPartyId":{"type":"string","nullable":true},"isImported":{"type":"boolean"}},"additionalProperties":false},"StringStringKeyValuePair":{"type":"object","properties":{"key":{"type":"string","nullable":true},"value":{"type":"string","nullable":true}},"additionalProperties":false},"ErrorResponse":{"type":"object","properties":{"code":{"type":"string","description":"Gets or sets the machine-readable error code (e.g.\r\n`VALIDATION_FAILED`, `RESOURCE_NOT_FOUND`,\r\n`INTERNAL_ERROR`) per cross-cutting-design.md §5.1.","nullable":true},"error":{"type":"string","description":"Gets or sets the human-readable error message.","nullable":true}},"additionalProperties":false,"description":"Structured body for 4xx / 5xx responses on the new Public API surface:\r\na machine-readable SchoolsBuddy.PublicAPI.Models.ErrorResponse.Code plus a human-readable\r\nSchoolsBuddy.PublicAPI.Models.ErrorResponse.Error. See cross-cutting-design.md §5.3. This is additive —\r\nexisting endpoints continue returning their legacy plain-string /\r\nModelState shapes until migrated by their per-controller ticket."}}},"paths":{"/api/v1/Groups/Subject":{"get":{"tags":["Subject"],"summary":"Gets a paginated list of Subjects for the calling organisation(s),\r\nsorted by id. Archived Subjects are added when includeArchived is true.","parameters":[{"name":"IncludeArchived","in":"query","schema":{"type":"boolean"}},{"name":"PageNumber","in":"query","schema":{"maximum":2147483647,"minimum":1,"type":"integer","format":"int32"}},{"name":"PageSize","in":"query","schema":{"maximum":2000,"minimum":1,"type":"integer","format":"int32"}},{"name":"OrganisationIds","in":"query","schema":{"type":"array","items":{"type":"integer","format":"int32"}}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubjectResponseDtoListPagedSubjectFilterResponseDto"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## POST /api/v1/Groups/Subject

> Creates a Subject. The Subject always starts unarchived and is never> \
> import-managed (ThirdPartyId is not set).

```json
{"openapi":"3.0.1","info":{"title":"SchoolsBuddy Public API","version":"1.0"},"servers":[{"url":"https://publicapi-eu.schoolsbuddy.net","description":"EMEA Public Api server"},{"url":"https://publicapi-asia.schoolsbuddy.net","description":"Asia Public Api server"},{"url":"https://publicapi-us.schoolsbuddy.net","description":"US Public Api server"},{"url":"https://publicapi.schoolsbuddy.cn","description":"China Public Api server"},{"url":"https://identity-eu.schoolsbuddy.net","description":"EMEA Identity server"},{"url":"https://identity-asia.schoolsbuddy.net","description":"Asia Identity server"},{"url":"https://identity-us.schoolsbuddy.net","description":"US Identity server"},{"url":"https://accounts.schoolsbuddy.cn","description":"China Identity server"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"apiKey","description":"Type \"Bearer\" followed by a space and a token.","name":"Authorization","in":"header"}},"schemas":{"CreateSubjectRequestDto":{"required":["name"],"type":"object","properties":{"name":{"maxLength":200,"minLength":1,"type":"string"}},"additionalProperties":false},"SubjectResponseDto":{"type":"object","properties":{"id":{"type":"integer","format":"int32"},"organisationId":{"type":"integer","format":"int32"},"name":{"type":"string","nullable":true},"isArchived":{"type":"boolean"},"createdAtUtc":{"type":"string","format":"date-time"},"updatedAtUtc":{"type":"string","format":"date-time"},"thirdPartyId":{"type":"string","nullable":true},"isImported":{"type":"boolean"}},"additionalProperties":false},"ErrorResponse":{"type":"object","properties":{"code":{"type":"string","description":"Gets or sets the machine-readable error code (e.g.\r\n`VALIDATION_FAILED`, `RESOURCE_NOT_FOUND`,\r\n`INTERNAL_ERROR`) per cross-cutting-design.md §5.1.","nullable":true},"error":{"type":"string","description":"Gets or sets the human-readable error message.","nullable":true}},"additionalProperties":false,"description":"Structured body for 4xx / 5xx responses on the new Public API surface:\r\na machine-readable SchoolsBuddy.PublicAPI.Models.ErrorResponse.Code plus a human-readable\r\nSchoolsBuddy.PublicAPI.Models.ErrorResponse.Error. See cross-cutting-design.md §5.3. This is additive —\r\nexisting endpoints continue returning their legacy plain-string /\r\nModelState shapes until migrated by their per-controller ticket."}}},"paths":{"/api/v1/Groups/Subject":{"post":{"tags":["Subject"],"summary":"Creates a Subject. The Subject always starts unarchived and is never\r\nimport-managed (ThirdPartyId is not set).","parameters":[{"name":"organisationId","in":"query","description":"The organisation to create the Subject in — required when the client has access to multiple organisations","schema":{"type":"integer","format":"int32"}}],"requestBody":{"description":"The create request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSubjectRequestDto"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubjectResponseDto"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## GET /api/v1/Groups/Subject/{id}

> Gets a single Subject by id. Archived Subjects return> \
> 404 SUBJECT\_NOT\_FOUND (§11).

```json
{"openapi":"3.0.1","info":{"title":"SchoolsBuddy Public API","version":"1.0"},"servers":[{"url":"https://publicapi-eu.schoolsbuddy.net","description":"EMEA Public Api server"},{"url":"https://publicapi-asia.schoolsbuddy.net","description":"Asia Public Api server"},{"url":"https://publicapi-us.schoolsbuddy.net","description":"US Public Api server"},{"url":"https://publicapi.schoolsbuddy.cn","description":"China Public Api server"},{"url":"https://identity-eu.schoolsbuddy.net","description":"EMEA Identity server"},{"url":"https://identity-asia.schoolsbuddy.net","description":"Asia Identity server"},{"url":"https://identity-us.schoolsbuddy.net","description":"US Identity server"},{"url":"https://accounts.schoolsbuddy.cn","description":"China Identity server"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"apiKey","description":"Type \"Bearer\" followed by a space and a token.","name":"Authorization","in":"header"}},"schemas":{"SubjectResponseDto":{"type":"object","properties":{"id":{"type":"integer","format":"int32"},"organisationId":{"type":"integer","format":"int32"},"name":{"type":"string","nullable":true},"isArchived":{"type":"boolean"},"createdAtUtc":{"type":"string","format":"date-time"},"updatedAtUtc":{"type":"string","format":"date-time"},"thirdPartyId":{"type":"string","nullable":true},"isImported":{"type":"boolean"}},"additionalProperties":false},"ErrorResponse":{"type":"object","properties":{"code":{"type":"string","description":"Gets or sets the machine-readable error code (e.g.\r\n`VALIDATION_FAILED`, `RESOURCE_NOT_FOUND`,\r\n`INTERNAL_ERROR`) per cross-cutting-design.md §5.1.","nullable":true},"error":{"type":"string","description":"Gets or sets the human-readable error message.","nullable":true}},"additionalProperties":false,"description":"Structured body for 4xx / 5xx responses on the new Public API surface:\r\na machine-readable SchoolsBuddy.PublicAPI.Models.ErrorResponse.Code plus a human-readable\r\nSchoolsBuddy.PublicAPI.Models.ErrorResponse.Error. See cross-cutting-design.md §5.3. This is additive —\r\nexisting endpoints continue returning their legacy plain-string /\r\nModelState shapes until migrated by their per-controller ticket."}}},"paths":{"/api/v1/Groups/Subject/{id}":{"get":{"tags":["Subject"],"summary":"Gets a single Subject by id. Archived Subjects return\r\n404 SUBJECT_NOT_FOUND (§11).","parameters":[{"name":"id","in":"path","description":"The Subject id (Subject.Id)","required":true,"schema":{"type":"integer","format":"int32"}},{"name":"organisationId","in":"query","description":"The organisation to look the Subject up in — required when the client has access to multiple organisations","schema":{"type":"integer","format":"int32"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubjectResponseDto"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## PUT /api/v1/Groups/Subject/{id}

> Partially updates a Subject — omitted fields preserve their existing> \
> values (§3.7e). The URL {id} is the canonical identifier; the body> \
> carries no id. Setting isArchived = true cascade-archives the> \
> Subject's active SubjectClasses. Sending isArchived = false> \
> unarchives an archived Subject with no class cascade (EC-1 as> \
> amended 2026-07-31); any other write against an archived Subject> \
> returns 409 RESOURCE\_ARCHIVED.

```json
{"openapi":"3.0.1","info":{"title":"SchoolsBuddy Public API","version":"1.0"},"servers":[{"url":"https://publicapi-eu.schoolsbuddy.net","description":"EMEA Public Api server"},{"url":"https://publicapi-asia.schoolsbuddy.net","description":"Asia Public Api server"},{"url":"https://publicapi-us.schoolsbuddy.net","description":"US Public Api server"},{"url":"https://publicapi.schoolsbuddy.cn","description":"China Public Api server"},{"url":"https://identity-eu.schoolsbuddy.net","description":"EMEA Identity server"},{"url":"https://identity-asia.schoolsbuddy.net","description":"Asia Identity server"},{"url":"https://identity-us.schoolsbuddy.net","description":"US Identity server"},{"url":"https://accounts.schoolsbuddy.cn","description":"China Identity server"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"apiKey","description":"Type \"Bearer\" followed by a space and a token.","name":"Authorization","in":"header"}},"schemas":{"UpdateSubjectRequestDto":{"type":"object","properties":{"name":{"maxLength":200,"type":"string","nullable":true},"isArchived":{"type":"boolean","nullable":true}},"additionalProperties":false},"SubjectResponseDto":{"type":"object","properties":{"id":{"type":"integer","format":"int32"},"organisationId":{"type":"integer","format":"int32"},"name":{"type":"string","nullable":true},"isArchived":{"type":"boolean"},"createdAtUtc":{"type":"string","format":"date-time"},"updatedAtUtc":{"type":"string","format":"date-time"},"thirdPartyId":{"type":"string","nullable":true},"isImported":{"type":"boolean"}},"additionalProperties":false},"ErrorResponse":{"type":"object","properties":{"code":{"type":"string","description":"Gets or sets the machine-readable error code (e.g.\r\n`VALIDATION_FAILED`, `RESOURCE_NOT_FOUND`,\r\n`INTERNAL_ERROR`) per cross-cutting-design.md §5.1.","nullable":true},"error":{"type":"string","description":"Gets or sets the human-readable error message.","nullable":true}},"additionalProperties":false,"description":"Structured body for 4xx / 5xx responses on the new Public API surface:\r\na machine-readable SchoolsBuddy.PublicAPI.Models.ErrorResponse.Code plus a human-readable\r\nSchoolsBuddy.PublicAPI.Models.ErrorResponse.Error. See cross-cutting-design.md §5.3. This is additive —\r\nexisting endpoints continue returning their legacy plain-string /\r\nModelState shapes until migrated by their per-controller ticket."}}},"paths":{"/api/v1/Groups/Subject/{id}":{"put":{"tags":["Subject"],"summary":"Partially updates a Subject — omitted fields preserve their existing\r\nvalues (§3.7e). The URL {id} is the canonical identifier; the body\r\ncarries no id. Setting isArchived = true cascade-archives the\r\nSubject's active SubjectClasses. Sending isArchived = false\r\nunarchives an archived Subject with no class cascade (EC-1 as\r\namended 2026-07-31); any other write against an archived Subject\r\nreturns 409 RESOURCE_ARCHIVED.","parameters":[{"name":"id","in":"path","description":"The Subject id (Subject.Id)","required":true,"schema":{"type":"integer","format":"int32"}},{"name":"organisationId","in":"query","description":"The organisation the Subject belongs to — required when the client has access to multiple organisations","schema":{"type":"integer","format":"int32"}}],"requestBody":{"description":"The update request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSubjectRequestDto"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubjectResponseDto"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## POST /api/v1/Groups/Subject/BulkCreate

> Creates Subjects in bulk. Items are processed independently — per-item> \
> failures are reported in failedItems\[] and do not roll back the> \
> other items.

```json
{"openapi":"3.0.1","info":{"title":"SchoolsBuddy Public API","version":"1.0"},"servers":[{"url":"https://publicapi-eu.schoolsbuddy.net","description":"EMEA Public Api server"},{"url":"https://publicapi-asia.schoolsbuddy.net","description":"Asia Public Api server"},{"url":"https://publicapi-us.schoolsbuddy.net","description":"US Public Api server"},{"url":"https://publicapi.schoolsbuddy.cn","description":"China Public Api server"},{"url":"https://identity-eu.schoolsbuddy.net","description":"EMEA Identity server"},{"url":"https://identity-asia.schoolsbuddy.net","description":"Asia Identity server"},{"url":"https://identity-us.schoolsbuddy.net","description":"US Identity server"},{"url":"https://accounts.schoolsbuddy.cn","description":"China Identity server"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"apiKey","description":"Type \"Bearer\" followed by a space and a token.","name":"Authorization","in":"header"}},"schemas":{"BulkCreateSubjectRequestDto":{"type":"object","properties":{"organisationId":{"type":"integer","description":"Gets or sets the organisation the batch operates on. Optional\r\nwhen the calling client has access to a single organisation;\r\nrequired for multi-org clients.","format":"int32","nullable":true},"items":{"type":"array","items":{"$ref":"#/components/schemas/BulkCreateSubjectItemDto"},"description":"Gets or sets the Subjects to create. Each item is processed\r\nindependently; one failure does not roll back the others.\r\nItem-level validation deliberately bypasses automatic model\r\nvalidation — violations surface per item in failedItems[]\r\ninstead of failing the whole request (cross-cutting §6.1).","nullable":true}},"additionalProperties":false,"description":"Request body for POST /api/v1/Groups/Subject/BulkCreate (SB-15450).\r\nThe envelope-level organisationId scopes every item in the batch\r\n(cross-cutting §3.8.1) — items are not individually org-addressable."},"BulkCreateSubjectItemDto":{"required":["name"],"type":"object","properties":{"name":{"maxLength":200,"minLength":1,"type":"string"},"clientReferenceId":{"maxLength":100,"type":"string","nullable":true}},"additionalProperties":false},"Int32BulkOperationResult":{"type":"object","properties":{"successfulIds":{"type":"array","items":{"type":"integer","format":"int32"},"description":"Gets or sets the ids of the items that were processed successfully.\r\nOn BulkCreate these are the newly-created ids.","nullable":true},"failedItems":{"type":"array","items":{"$ref":"#/components/schemas/BulkFailedItem"},"description":"Gets or sets the per-item failures, each carrying its request index,\r\noptional client reference, name, machine-readable code, and message.","nullable":true},"totalRequested":{"type":"integer","description":"Gets or sets the total number of items in the request. Set by the\r\ncaller (it is not derivable from the success/failure lists alone —\r\nitems rejected before per-item processing may appear in neither).","format":"int32"},"totalSuccessful":{"type":"integer","description":"Gets the number of items processed successfully (computed).","format":"int32","readOnly":true},"totalFailed":{"type":"integer","description":"Gets the number of items that failed (computed).","format":"int32","readOnly":true}},"additionalProperties":false,"description":"Standard envelope returned by every Public API bulk endpoint\r\n(BulkCreate / BulkUpdate / BulkArchive). Each item in the request is\r\nprocessed independently — one item failing does not roll back the\r\nothers — and the envelope reports per-item outcome. See\r\ncross-cutting-design.md §4."},"BulkFailedItem":{"type":"object","properties":{"index":{"type":"integer","description":"Gets or sets the zero-based index of the failed item within the\r\nrequest array, so callers keeping request order can map it back.","format":"int32"},"clientReferenceId":{"type":"string","description":"Gets or sets the optional opaque client-supplied reference echoed\r\nback from the request item. Null when the caller did not supply one.","nullable":true},"name":{"type":"string","description":"Gets or sets the name of the entity the failed item referred to,\r\nfor at-a-glance identification in the response.","nullable":true},"code":{"type":"string","description":"Gets or sets the machine-readable error code (e.g.\r\n`VALIDATION_FAILED`, `GROUP_IMPORTED_READ_ONLY`) per\r\ncross-cutting-design.md §5.1.","nullable":true},"error":{"type":"string","description":"Gets or sets the human-readable error message.","nullable":true}},"additionalProperties":false,"description":"A single per-item failure entry in a SchoolsBuddy.PublicAPI.Models.BulkOperationResult`1\r\nenvelope. Mirrors the structured error body (cross-cutting-design.md §5.3):\r\na machine-readable SchoolsBuddy.PublicAPI.Models.BulkFailedItem.Code plus a human-readable SchoolsBuddy.PublicAPI.Models.BulkFailedItem.Error."},"ErrorResponse":{"type":"object","properties":{"code":{"type":"string","description":"Gets or sets the machine-readable error code (e.g.\r\n`VALIDATION_FAILED`, `RESOURCE_NOT_FOUND`,\r\n`INTERNAL_ERROR`) per cross-cutting-design.md §5.1.","nullable":true},"error":{"type":"string","description":"Gets or sets the human-readable error message.","nullable":true}},"additionalProperties":false,"description":"Structured body for 4xx / 5xx responses on the new Public API surface:\r\na machine-readable SchoolsBuddy.PublicAPI.Models.ErrorResponse.Code plus a human-readable\r\nSchoolsBuddy.PublicAPI.Models.ErrorResponse.Error. See cross-cutting-design.md §5.3. This is additive —\r\nexisting endpoints continue returning their legacy plain-string /\r\nModelState shapes until migrated by their per-controller ticket."}}},"paths":{"/api/v1/Groups/Subject/BulkCreate":{"post":{"tags":["Subject"],"summary":"Creates Subjects in bulk. Items are processed independently — per-item\r\nfailures are reported in failedItems[] and do not roll back the\r\nother items.","requestBody":{"description":"The bulk create envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkCreateSubjectRequestDto"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Int32BulkOperationResult"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## PUT /api/v1/Groups/Subject/BulkUpdate

> Partially updates Subjects in bulk. Each item carries the target id;> \
> items are processed independently. An item carrying> \
> isArchived = false unarchives an archived Subject (EC-1 as amended> \
> 2026-07-31).

```json
{"openapi":"3.0.1","info":{"title":"SchoolsBuddy Public API","version":"1.0"},"servers":[{"url":"https://publicapi-eu.schoolsbuddy.net","description":"EMEA Public Api server"},{"url":"https://publicapi-asia.schoolsbuddy.net","description":"Asia Public Api server"},{"url":"https://publicapi-us.schoolsbuddy.net","description":"US Public Api server"},{"url":"https://publicapi.schoolsbuddy.cn","description":"China Public Api server"},{"url":"https://identity-eu.schoolsbuddy.net","description":"EMEA Identity server"},{"url":"https://identity-asia.schoolsbuddy.net","description":"Asia Identity server"},{"url":"https://identity-us.schoolsbuddy.net","description":"US Identity server"},{"url":"https://accounts.schoolsbuddy.cn","description":"China Identity server"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"apiKey","description":"Type \"Bearer\" followed by a space and a token.","name":"Authorization","in":"header"}},"schemas":{"BulkUpdateSubjectRequestDto":{"type":"object","properties":{"organisationId":{"type":"integer","description":"Gets or sets the organisation the batch operates on. Optional\r\nwhen the calling client has access to a single organisation;\r\nrequired for multi-org clients.","format":"int32","nullable":true},"items":{"type":"array","items":{"$ref":"#/components/schemas/BulkUpdateSubjectItemDto"},"description":"Gets or sets the Subject updates. Each item is processed\r\nindependently; one failure does not roll back the others.\r\nItem-level validation deliberately bypasses automatic model\r\nvalidation — violations (including missing / 0 / negative id, EC-7)\r\nsurface per item in failedItems[] instead of failing the whole\r\nrequest (cross-cutting §6.1).","nullable":true}},"additionalProperties":false,"description":"Request body for PUT /api/v1/Groups/Subject/BulkUpdate (SB-15450).\r\nThe envelope-level organisationId scopes every item in the batch\r\n(cross-cutting §3.8.1)."},"BulkUpdateSubjectItemDto":{"type":"object","properties":{"name":{"maxLength":200,"type":"string","nullable":true},"isArchived":{"type":"boolean","nullable":true},"id":{"type":"integer","format":"int32","nullable":true},"clientReferenceId":{"maxLength":100,"type":"string","nullable":true}},"additionalProperties":false},"Int32BulkOperationResult":{"type":"object","properties":{"successfulIds":{"type":"array","items":{"type":"integer","format":"int32"},"description":"Gets or sets the ids of the items that were processed successfully.\r\nOn BulkCreate these are the newly-created ids.","nullable":true},"failedItems":{"type":"array","items":{"$ref":"#/components/schemas/BulkFailedItem"},"description":"Gets or sets the per-item failures, each carrying its request index,\r\noptional client reference, name, machine-readable code, and message.","nullable":true},"totalRequested":{"type":"integer","description":"Gets or sets the total number of items in the request. Set by the\r\ncaller (it is not derivable from the success/failure lists alone —\r\nitems rejected before per-item processing may appear in neither).","format":"int32"},"totalSuccessful":{"type":"integer","description":"Gets the number of items processed successfully (computed).","format":"int32","readOnly":true},"totalFailed":{"type":"integer","description":"Gets the number of items that failed (computed).","format":"int32","readOnly":true}},"additionalProperties":false,"description":"Standard envelope returned by every Public API bulk endpoint\r\n(BulkCreate / BulkUpdate / BulkArchive). Each item in the request is\r\nprocessed independently — one item failing does not roll back the\r\nothers — and the envelope reports per-item outcome. See\r\ncross-cutting-design.md §4."},"BulkFailedItem":{"type":"object","properties":{"index":{"type":"integer","description":"Gets or sets the zero-based index of the failed item within the\r\nrequest array, so callers keeping request order can map it back.","format":"int32"},"clientReferenceId":{"type":"string","description":"Gets or sets the optional opaque client-supplied reference echoed\r\nback from the request item. Null when the caller did not supply one.","nullable":true},"name":{"type":"string","description":"Gets or sets the name of the entity the failed item referred to,\r\nfor at-a-glance identification in the response.","nullable":true},"code":{"type":"string","description":"Gets or sets the machine-readable error code (e.g.\r\n`VALIDATION_FAILED`, `GROUP_IMPORTED_READ_ONLY`) per\r\ncross-cutting-design.md §5.1.","nullable":true},"error":{"type":"string","description":"Gets or sets the human-readable error message.","nullable":true}},"additionalProperties":false,"description":"A single per-item failure entry in a SchoolsBuddy.PublicAPI.Models.BulkOperationResult`1\r\nenvelope. Mirrors the structured error body (cross-cutting-design.md §5.3):\r\na machine-readable SchoolsBuddy.PublicAPI.Models.BulkFailedItem.Code plus a human-readable SchoolsBuddy.PublicAPI.Models.BulkFailedItem.Error."},"ErrorResponse":{"type":"object","properties":{"code":{"type":"string","description":"Gets or sets the machine-readable error code (e.g.\r\n`VALIDATION_FAILED`, `RESOURCE_NOT_FOUND`,\r\n`INTERNAL_ERROR`) per cross-cutting-design.md §5.1.","nullable":true},"error":{"type":"string","description":"Gets or sets the human-readable error message.","nullable":true}},"additionalProperties":false,"description":"Structured body for 4xx / 5xx responses on the new Public API surface:\r\na machine-readable SchoolsBuddy.PublicAPI.Models.ErrorResponse.Code plus a human-readable\r\nSchoolsBuddy.PublicAPI.Models.ErrorResponse.Error. See cross-cutting-design.md §5.3. This is additive —\r\nexisting endpoints continue returning their legacy plain-string /\r\nModelState shapes until migrated by their per-controller ticket."}}},"paths":{"/api/v1/Groups/Subject/BulkUpdate":{"put":{"tags":["Subject"],"summary":"Partially updates Subjects in bulk. Each item carries the target id;\r\nitems are processed independently. An item carrying\r\nisArchived = false unarchives an archived Subject (EC-1 as amended\r\n2026-07-31).","requestBody":{"description":"The bulk update envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkUpdateSubjectRequestDto"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Int32BulkOperationResult"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## POST /api/v1/Groups/Subject/BulkArchive

> Archives or unarchives Subjects in bulk (toggleable via the isArchived> \
> body flag). Archiving cascade-archives each Subject's active> \
> SubjectClasses; unarchiving restores the Subject only. Alongside> \
> PUT / BulkUpdate items carrying isArchived = false, the write verbs> \
> allowed against already-archived Subjects (EC-1 as amended> \
> 2026-07-31).

```json
{"openapi":"3.0.1","info":{"title":"SchoolsBuddy Public API","version":"1.0"},"servers":[{"url":"https://publicapi-eu.schoolsbuddy.net","description":"EMEA Public Api server"},{"url":"https://publicapi-asia.schoolsbuddy.net","description":"Asia Public Api server"},{"url":"https://publicapi-us.schoolsbuddy.net","description":"US Public Api server"},{"url":"https://publicapi.schoolsbuddy.cn","description":"China Public Api server"},{"url":"https://identity-eu.schoolsbuddy.net","description":"EMEA Identity server"},{"url":"https://identity-asia.schoolsbuddy.net","description":"Asia Identity server"},{"url":"https://identity-us.schoolsbuddy.net","description":"US Identity server"},{"url":"https://accounts.schoolsbuddy.cn","description":"China Identity server"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"apiKey","description":"Type \"Bearer\" followed by a space and a token.","name":"Authorization","in":"header"}},"schemas":{"BulkArchiveSubjectRequestDto":{"required":["ids"],"type":"object","properties":{"organisationId":{"type":"integer","description":"Gets or sets the organisation the batch operates on. Optional\r\nwhen the calling client has access to a single organisation;\r\nrequired for multi-org clients.","format":"int32","nullable":true},"ids":{"minItems":1,"type":"array","items":{"type":"integer","format":"int32"},"description":"Gets or sets the ids (Subject.Id) of the Subjects to transition. Id\r\nvalidity is checked per item (EC-7) — 0 / negative ids fail that\r\nitem only."},"isArchived":{"type":"boolean","description":"Gets or sets a value indicating whether the Subjects are archived\r\n(true, default) or unarchived (false)."}},"additionalProperties":false,"description":"Request body for POST /api/v1/Groups/Subject/BulkArchive (SB-15450).\r\nToggleable: isArchived true archives (and cascade-archives each Subject's\r\nactive SubjectClasses, archive-strategy §2.6), false unarchives the\r\nSubject only (no class cascade). BulkArchive and a PUT / BulkUpdate\r\nitem carrying isArchived: false are the verbs allowed to operate on\r\nalready-archived rows (EC-1 as amended 2026-07-31)."},"Int32BulkOperationResult":{"type":"object","properties":{"successfulIds":{"type":"array","items":{"type":"integer","format":"int32"},"description":"Gets or sets the ids of the items that were processed successfully.\r\nOn BulkCreate these are the newly-created ids.","nullable":true},"failedItems":{"type":"array","items":{"$ref":"#/components/schemas/BulkFailedItem"},"description":"Gets or sets the per-item failures, each carrying its request index,\r\noptional client reference, name, machine-readable code, and message.","nullable":true},"totalRequested":{"type":"integer","description":"Gets or sets the total number of items in the request. Set by the\r\ncaller (it is not derivable from the success/failure lists alone —\r\nitems rejected before per-item processing may appear in neither).","format":"int32"},"totalSuccessful":{"type":"integer","description":"Gets the number of items processed successfully (computed).","format":"int32","readOnly":true},"totalFailed":{"type":"integer","description":"Gets the number of items that failed (computed).","format":"int32","readOnly":true}},"additionalProperties":false,"description":"Standard envelope returned by every Public API bulk endpoint\r\n(BulkCreate / BulkUpdate / BulkArchive). Each item in the request is\r\nprocessed independently — one item failing does not roll back the\r\nothers — and the envelope reports per-item outcome. See\r\ncross-cutting-design.md §4."},"BulkFailedItem":{"type":"object","properties":{"index":{"type":"integer","description":"Gets or sets the zero-based index of the failed item within the\r\nrequest array, so callers keeping request order can map it back.","format":"int32"},"clientReferenceId":{"type":"string","description":"Gets or sets the optional opaque client-supplied reference echoed\r\nback from the request item. Null when the caller did not supply one.","nullable":true},"name":{"type":"string","description":"Gets or sets the name of the entity the failed item referred to,\r\nfor at-a-glance identification in the response.","nullable":true},"code":{"type":"string","description":"Gets or sets the machine-readable error code (e.g.\r\n`VALIDATION_FAILED`, `GROUP_IMPORTED_READ_ONLY`) per\r\ncross-cutting-design.md §5.1.","nullable":true},"error":{"type":"string","description":"Gets or sets the human-readable error message.","nullable":true}},"additionalProperties":false,"description":"A single per-item failure entry in a SchoolsBuddy.PublicAPI.Models.BulkOperationResult`1\r\nenvelope. Mirrors the structured error body (cross-cutting-design.md §5.3):\r\na machine-readable SchoolsBuddy.PublicAPI.Models.BulkFailedItem.Code plus a human-readable SchoolsBuddy.PublicAPI.Models.BulkFailedItem.Error."},"ErrorResponse":{"type":"object","properties":{"code":{"type":"string","description":"Gets or sets the machine-readable error code (e.g.\r\n`VALIDATION_FAILED`, `RESOURCE_NOT_FOUND`,\r\n`INTERNAL_ERROR`) per cross-cutting-design.md §5.1.","nullable":true},"error":{"type":"string","description":"Gets or sets the human-readable error message.","nullable":true}},"additionalProperties":false,"description":"Structured body for 4xx / 5xx responses on the new Public API surface:\r\na machine-readable SchoolsBuddy.PublicAPI.Models.ErrorResponse.Code plus a human-readable\r\nSchoolsBuddy.PublicAPI.Models.ErrorResponse.Error. See cross-cutting-design.md §5.3. This is additive —\r\nexisting endpoints continue returning their legacy plain-string /\r\nModelState shapes until migrated by their per-controller ticket."}}},"paths":{"/api/v1/Groups/Subject/BulkArchive":{"post":{"tags":["Subject"],"summary":"Archives or unarchives Subjects in bulk (toggleable via the isArchived\r\nbody flag). Archiving cascade-archives each Subject's active\r\nSubjectClasses; unarchiving restores the Subject only. Alongside\r\nPUT / BulkUpdate items carrying isArchived = false, the write verbs\r\nallowed against already-archived Subjects (EC-1 as amended\r\n2026-07-31).","requestBody":{"description":"The bulk archive envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkArchiveSubjectRequestDto"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Int32BulkOperationResult"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```
