# Claim Hooks

## Creates a claim hook

> This route creates a claim hook. Claim hooks are an atomic action that will be performed when a boost is claimed

```json
{"openapi":"3.1.0","info":{"title":"LearnCloud Network API","version":"1.0.0"},"tags":[{"name":"Claim Hooks"}],"servers":[{"url":"../api"}],"security":[{"Authorization":[]}],"components":{"securitySchemes":{"Authorization":{"type":"http","scheme":"bearer"}},"schemas":{"error.BAD_REQUEST":{"title":"Invalid input data error (400)","description":"The error information","type":"object","properties":{"message":{"description":"The error message","type":"string"},"code":{"description":"The error code","type":"string"},"issues":{"description":"An array of issues that were responsible for the error","type":"array","items":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"],"additionalProperties":false}}},"required":["message","code"],"additionalProperties":false},"error.UNAUTHORIZED":{"title":"Authorization not provided error (401)","description":"The error information","type":"object","properties":{"message":{"description":"The error message","type":"string"},"code":{"description":"The error code","type":"string"},"issues":{"description":"An array of issues that were responsible for the error","type":"array","items":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"],"additionalProperties":false}}},"required":["message","code"],"additionalProperties":false},"error.FORBIDDEN":{"title":"Insufficient access error (403)","description":"The error information","type":"object","properties":{"message":{"description":"The error message","type":"string"},"code":{"description":"The error code","type":"string"},"issues":{"description":"An array of issues that were responsible for the error","type":"array","items":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"],"additionalProperties":false}}},"required":["message","code"],"additionalProperties":false},"error.INTERNAL_SERVER_ERROR":{"title":"Internal server error error (500)","description":"The error information","type":"object","properties":{"message":{"description":"The error message","type":"string"},"code":{"description":"The error code","type":"string"},"issues":{"description":"An array of issues that were responsible for the error","type":"array","items":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"],"additionalProperties":false}}},"required":["message","code"],"additionalProperties":false}}},"paths":{"/claim-hook/create":{"post":{"operationId":"claimHook-createClaimHook","summary":"Creates a claim hook","description":"This route creates a claim hook. Claim hooks are an atomic action that will be performed when a boost is claimed","tags":["Claim Hooks"],"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"hook":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","const":"GRANT_PERMISSIONS"},"data":{"type":"object","properties":{"claimUri":{"type":"string"},"targetUri":{"type":"string"},"permissions":{"type":"object","properties":{"role":{"type":"string"},"canView":{"default":true,"type":"boolean"},"canEdit":{"type":"boolean"},"canIssue":{"type":"boolean"},"canRevoke":{"type":"boolean"},"canManagePermissions":{"type":"boolean"},"canIssueChildren":{"type":"string"},"canCreateChildren":{"type":"string"},"canEditChildren":{"type":"string"},"canRevokeChildren":{"type":"string"},"canManageChildrenPermissions":{"type":"string"},"canManageChildrenProfiles":{"type":"boolean"},"canViewAnalytics":{"type":"boolean"}}}},"required":["claimUri","targetUri","permissions"]}},"required":["type","data"]},{"type":"object","properties":{"type":{"type":"string","const":"ADD_ADMIN"},"data":{"type":"object","properties":{"claimUri":{"type":"string"},"targetUri":{"type":"string"}},"required":["claimUri","targetUri"]}},"required":["type","data"]},{"type":"object","properties":{"type":{"type":"string","const":"AUTO_CONNECT"},"data":{"type":"object","properties":{"claimUri":{"type":"string"},"targetUri":{"type":"string"}},"required":["claimUri","targetUri"]}},"required":["type","data"]}],"type":"object"}},"required":["hook"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"string"}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}}}}
```

## Gets Claim Hooks

> This route gets claim hooks attached to a given boost

```json
{"openapi":"3.1.0","info":{"title":"LearnCloud Network API","version":"1.0.0"},"tags":[{"name":"Claim Hooks"}],"servers":[{"url":"../api"}],"security":[{"Authorization":[]}],"components":{"securitySchemes":{"Authorization":{"type":"http","scheme":"bearer"}},"schemas":{"error.BAD_REQUEST":{"title":"Invalid input data error (400)","description":"The error information","type":"object","properties":{"message":{"description":"The error message","type":"string"},"code":{"description":"The error code","type":"string"},"issues":{"description":"An array of issues that were responsible for the error","type":"array","items":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"],"additionalProperties":false}}},"required":["message","code"],"additionalProperties":false},"error.UNAUTHORIZED":{"title":"Authorization not provided error (401)","description":"The error information","type":"object","properties":{"message":{"description":"The error message","type":"string"},"code":{"description":"The error code","type":"string"},"issues":{"description":"An array of issues that were responsible for the error","type":"array","items":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"],"additionalProperties":false}}},"required":["message","code"],"additionalProperties":false},"error.FORBIDDEN":{"title":"Insufficient access error (403)","description":"The error information","type":"object","properties":{"message":{"description":"The error message","type":"string"},"code":{"description":"The error code","type":"string"},"issues":{"description":"An array of issues that were responsible for the error","type":"array","items":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"],"additionalProperties":false}}},"required":["message","code"],"additionalProperties":false},"error.INTERNAL_SERVER_ERROR":{"title":"Internal server error error (500)","description":"The error information","type":"object","properties":{"message":{"description":"The error message","type":"string"},"code":{"description":"The error code","type":"string"},"issues":{"description":"An array of issues that were responsible for the error","type":"array","items":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"],"additionalProperties":false}}},"required":["message","code"],"additionalProperties":false}}},"paths":{"/claim-hook/get":{"post":{"operationId":"claimHook-getClaimHooksForBoost","summary":"Gets Claim Hooks","description":"This route gets claim hooks attached to a given boost","tags":["Claim Hooks"],"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"limit":{"default":25,"type":"number"},"cursor":{"type":"string"},"sort":{"type":"string"},"query":{"type":"object","properties":{"type":{"anyOf":[{"anyOf":[{"anyOf":[{"type":"string"},{"type":"object","properties":{"$in":{"type":"array","items":{"type":"string"}}},"required":["$in"]}]},{"type":"object","properties":{"$regex":{"anyOf":[{"type":"string"},{"type":"string"}],"type":"string"}},"required":["$regex"]}]},{"type":"object","properties":{"$or":{"type":"array","items":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"object","properties":{"$in":{"type":"array","items":{"type":"string"}}},"required":["$in"]}]},{"type":"object","properties":{"$regex":{"anyOf":[{"type":"string"},{"type":"string"}],"type":"string"}},"required":["$regex"]}]}}},"required":["$or"]}]},"data":{"type":"object","properties":{"claimUri":{"anyOf":[{"anyOf":[{"anyOf":[{"type":"string"},{"type":"object","properties":{"$in":{"type":"array","items":{"type":"string"}}},"required":["$in"]}]},{"type":"object","properties":{"$regex":{"anyOf":[{"type":"string"},{"type":"string"}],"type":"string"}},"required":["$regex"]}]},{"type":"object","properties":{"$or":{"type":"array","items":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"object","properties":{"$in":{"type":"array","items":{"type":"string"}}},"required":["$in"]}]},{"type":"object","properties":{"$regex":{"anyOf":[{"type":"string"},{"type":"string"}],"type":"string"}},"required":["$regex"]}]}}},"required":["$or"]}]},"targetUri":{"anyOf":[{"anyOf":[{"anyOf":[{"type":"string"},{"type":"object","properties":{"$in":{"type":"array","items":{"type":"string"}}},"required":["$in"]}]},{"type":"object","properties":{"$regex":{"anyOf":[{"type":"string"},{"type":"string"}],"type":"string"}},"required":["$regex"]}]},{"type":"object","properties":{"$or":{"type":"array","items":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"object","properties":{"$in":{"type":"array","items":{"type":"string"}}},"required":["$in"]}]},{"type":"object","properties":{"$regex":{"anyOf":[{"type":"string"},{"type":"string"}],"type":"string"}},"required":["$regex"]}]}}},"required":["$or"]}]},"permissions":{"type":"object","properties":{"role":{"anyOf":[{"anyOf":[{"anyOf":[{"type":"string"},{"type":"object","properties":{"$in":{"type":"array","items":{"type":"string"}}},"required":["$in"]}]},{"type":"object","properties":{"$regex":{"anyOf":[{"type":"string"},{"type":"string"}],"type":"string"}},"required":["$regex"]}]},{"type":"object","properties":{"$or":{"type":"array","items":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"object","properties":{"$in":{"type":"array","items":{"type":"string"}}},"required":["$in"]}]},{"type":"object","properties":{"$regex":{"anyOf":[{"type":"string"},{"type":"string"}],"type":"string"}},"required":["$regex"]}]}}},"required":["$or"]}]},"canView":{"type":"boolean"},"canEdit":{"type":"boolean"},"canIssue":{"type":"boolean"},"canRevoke":{"type":"boolean"},"canManagePermissions":{"type":"boolean"},"canIssueChildren":{"anyOf":[{"anyOf":[{"anyOf":[{"type":"string"},{"type":"object","properties":{"$in":{"type":"array","items":{"type":"string"}}},"required":["$in"]}]},{"type":"object","properties":{"$regex":{"anyOf":[{"type":"string"},{"type":"string"}],"type":"string"}},"required":["$regex"]}]},{"type":"object","properties":{"$or":{"type":"array","items":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"object","properties":{"$in":{"type":"array","items":{"type":"string"}}},"required":["$in"]}]},{"type":"object","properties":{"$regex":{"anyOf":[{"type":"string"},{"type":"string"}],"type":"string"}},"required":["$regex"]}]}}},"required":["$or"]}]},"canCreateChildren":{"anyOf":[{"anyOf":[{"anyOf":[{"type":"string"},{"type":"object","properties":{"$in":{"type":"array","items":{"type":"string"}}},"required":["$in"]}]},{"type":"object","properties":{"$regex":{"anyOf":[{"type":"string"},{"type":"string"}],"type":"string"}},"required":["$regex"]}]},{"type":"object","properties":{"$or":{"type":"array","items":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"object","properties":{"$in":{"type":"array","items":{"type":"string"}}},"required":["$in"]}]},{"type":"object","properties":{"$regex":{"anyOf":[{"type":"string"},{"type":"string"}],"type":"string"}},"required":["$regex"]}]}}},"required":["$or"]}]},"canEditChildren":{"anyOf":[{"anyOf":[{"anyOf":[{"type":"string"},{"type":"object","properties":{"$in":{"type":"array","items":{"type":"string"}}},"required":["$in"]}]},{"type":"object","properties":{"$regex":{"anyOf":[{"type":"string"},{"type":"string"}],"type":"string"}},"required":["$regex"]}]},{"type":"object","properties":{"$or":{"type":"array","items":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"object","properties":{"$in":{"type":"array","items":{"type":"string"}}},"required":["$in"]}]},{"type":"object","properties":{"$regex":{"anyOf":[{"type":"string"},{"type":"string"}],"type":"string"}},"required":["$regex"]}]}}},"required":["$or"]}]},"canRevokeChildren":{"anyOf":[{"anyOf":[{"anyOf":[{"type":"string"},{"type":"object","properties":{"$in":{"type":"array","items":{"type":"string"}}},"required":["$in"]}]},{"type":"object","properties":{"$regex":{"anyOf":[{"type":"string"},{"type":"string"}],"type":"string"}},"required":["$regex"]}]},{"type":"object","properties":{"$or":{"type":"array","items":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"object","properties":{"$in":{"type":"array","items":{"type":"string"}}},"required":["$in"]}]},{"type":"object","properties":{"$regex":{"anyOf":[{"type":"string"},{"type":"string"}],"type":"string"}},"required":["$regex"]}]}}},"required":["$or"]}]},"canManageChildrenPermissions":{"anyOf":[{"anyOf":[{"anyOf":[{"type":"string"},{"type":"object","properties":{"$in":{"type":"array","items":{"type":"string"}}},"required":["$in"]}]},{"type":"object","properties":{"$regex":{"anyOf":[{"type":"string"},{"type":"string"}],"type":"string"}},"required":["$regex"]}]},{"type":"object","properties":{"$or":{"type":"array","items":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"object","properties":{"$in":{"type":"array","items":{"type":"string"}}},"required":["$in"]}]},{"type":"object","properties":{"$regex":{"anyOf":[{"type":"string"},{"type":"string"}],"type":"string"}},"required":["$regex"]}]}}},"required":["$or"]}]},"canManageChildrenProfiles":{"type":"boolean"},"canViewAnalytics":{"type":"boolean"}}}}}},"required":["type","data"]},"uri":{"type":"string"}},"required":["uri"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"cursor":{"type":"string"},"hasMore":{"type":"boolean"},"records":{"type":"array","items":{"allOf":[{"type":"object","properties":{"id":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","createdAt","updatedAt"],"additionalProperties":false},{"oneOf":[{"type":"object","properties":{"type":{"type":"string","const":"GRANT_PERMISSIONS"},"data":{"type":"object","properties":{"claimUri":{"type":"string"},"targetUri":{"type":"string"},"permissions":{"type":"object","properties":{"role":{"type":"string"},"canView":{"default":true,"type":"boolean"},"canEdit":{"type":"boolean"},"canIssue":{"type":"boolean"},"canRevoke":{"type":"boolean"},"canManagePermissions":{"type":"boolean"},"canIssueChildren":{"type":"string"},"canCreateChildren":{"type":"string"},"canEditChildren":{"type":"string"},"canRevokeChildren":{"type":"string"},"canManageChildrenPermissions":{"type":"string"},"canManageChildrenProfiles":{"type":"boolean"},"canViewAnalytics":{"type":"boolean"}},"additionalProperties":false}},"required":["claimUri","targetUri","permissions"],"additionalProperties":false}},"required":["type","data"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"ADD_ADMIN"},"data":{"type":"object","properties":{"claimUri":{"type":"string"},"targetUri":{"type":"string"}},"required":["claimUri","targetUri"],"additionalProperties":false}},"required":["type","data"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"AUTO_CONNECT"},"data":{"type":"object","properties":{"claimUri":{"type":"string"},"targetUri":{"type":"string"}},"required":["claimUri","targetUri"],"additionalProperties":false}},"required":["type","data"],"additionalProperties":false}],"type":"object"}]}}},"required":["hasMore","records"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}}}}
```

## Delete a Claim Hook

> This route deletes a claim hook

```json
{"openapi":"3.1.0","info":{"title":"LearnCloud Network API","version":"1.0.0"},"tags":[{"name":"Claim Hooks"}],"servers":[{"url":"../api"}],"security":[{"Authorization":[]}],"components":{"securitySchemes":{"Authorization":{"type":"http","scheme":"bearer"}},"schemas":{"error.BAD_REQUEST":{"title":"Invalid input data error (400)","description":"The error information","type":"object","properties":{"message":{"description":"The error message","type":"string"},"code":{"description":"The error code","type":"string"},"issues":{"description":"An array of issues that were responsible for the error","type":"array","items":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"],"additionalProperties":false}}},"required":["message","code"],"additionalProperties":false},"error.UNAUTHORIZED":{"title":"Authorization not provided error (401)","description":"The error information","type":"object","properties":{"message":{"description":"The error message","type":"string"},"code":{"description":"The error code","type":"string"},"issues":{"description":"An array of issues that were responsible for the error","type":"array","items":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"],"additionalProperties":false}}},"required":["message","code"],"additionalProperties":false},"error.FORBIDDEN":{"title":"Insufficient access error (403)","description":"The error information","type":"object","properties":{"message":{"description":"The error message","type":"string"},"code":{"description":"The error code","type":"string"},"issues":{"description":"An array of issues that were responsible for the error","type":"array","items":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"],"additionalProperties":false}}},"required":["message","code"],"additionalProperties":false},"error.INTERNAL_SERVER_ERROR":{"title":"Internal server error error (500)","description":"The error information","type":"object","properties":{"message":{"description":"The error message","type":"string"},"code":{"description":"The error code","type":"string"},"issues":{"description":"An array of issues that were responsible for the error","type":"array","items":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"],"additionalProperties":false}}},"required":["message","code"],"additionalProperties":false}}},"paths":{"/claim-hook/update":{"post":{"operationId":"claimHook-deleteClaimHook","summary":"Delete a Claim Hook","description":"This route deletes a claim hook","tags":["Claim Hooks"],"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"boolean"}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}}}}
```
