# Approval

## Checking the resource approval

> Checks the approval for given resource. The endpoint verifies whether a user is authorized to perform a specific action on a given resource within a tenant.\
> \
> In case of any validation problems, the below \`errorCodes\` can be returned:\
> &#x20; \- \*\*APPROVAL-400011\*\*: Requested user is not assigned to any company\
> \
> \*\*\*\
> \*\*Required scopes\*\*\
> \* \`approval.approval\_read\_own\`<br>

```json
{"openapi":"3.0.0","info":{"title":"Approval Service","version":"0.0.1"},"tags":[{"name":"Approval"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"CustomerAccessToken":[]}],"components":{"securitySchemes":{"CustomerAccessToken":{"type":"http","scheme":"bearer","description":"To generate a customer access token, go to the [Logging in a customer](https://developer.emporix.io/api-references/api-guides/companies-and-customers/customer-management/api-reference/authentication-and-authorization#post-customer-tenant-login) endpoint."}},"responses":{"ApprovalPermittedResponse_200":{"description":"Approval permitted response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/approvalPermittedResponse"}}}},"approvals_response_BadRequest_400":{"description":"Bad request due to validation, incorrect parameters, etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/coreErrorMessage"}}}},"common_response_Unauthorized_401":{"description":"Unauthorized.","content":{"application/json":{"schema":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"common_response_Forbidden_403":{"description":"Access forbidden. The caller is not allowed to access this resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/coreErrorMessage"}}}}},"schemas":{"approvalPermittedResponse":{"title":"approval permitted response","allOf":[{"type":"object","description":"Base schema for approval permitted response.","properties":{"action":{"$ref":"#/components/schemas/approvalAction"},"status":{"$ref":"#/components/schemas/approvalStatus"},"permitted":{"type":"boolean","description":"Indicates if the operation is permitted."},"approvalId":{"type":"string","description":"Identifier of the approval."}},"required":["permitted","action"]}]},"approvalAction":{"title":"An approval action","description":"Base schema for an approval action type.","type":"string","enum":["CHECKOUT"]},"approvalStatus":{"title":"A status of the approval","description":"Base schema for the approval status.","type":"string","enum":["PENDING","APPROVED","CLOSED","EXPIRED","DECLINED"]},"coreErrorMessage":{"type":"object","properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status."},"message":{"type":"string","description":"Error message."},"errorCode":{"type":"string","description":"code of the error."},"details":{"description":"Details information.","type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"type":{"type":"string"},"message":{"type":"string"},"moreInfo":{"type":"string"}}}}}},"approvalPermittedRequest":{"title":"approval permitted request","type":"object","properties":{"resourceType":{"$ref":"#/components/schemas/resourceType"},"resourceId":{"type":"string","description":"An identifier of the resource for approval."},"action":{"$ref":"#/components/schemas/approvalAction"}},"required":["resourceType","resourceId","action"]},"resourceType":{"title":"A type of a resource","description":"Base schema for an approval resource type.","type":"string","enum":["CART"]}},"requestBodies":{"approvalPermittedRequestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/approvalPermittedRequest"}}}}},"parameters":{"path_tenant":{"name":"tenant","in":"path","required":true,"description":"Your Emporix tenant name.\n**Note**: The tenant name should always be written in lowercase.\n","schema":{"pattern":"^[a-z][a-z0-9]+$","minLength":3,"maxLength":16,"type":"string"}}}},"paths":{"/approval/{tenant}/approval/permitted":{"post":{"summary":"Checking the resource approval","responses":{"200":{"$ref":"#/components/responses/ApprovalPermittedResponse_200"},"400":{"$ref":"#/components/responses/approvals_response_BadRequest_400"},"401":{"$ref":"#/components/responses/common_response_Unauthorized_401"},"403":{"$ref":"#/components/responses/common_response_Forbidden_403"}},"description":"Checks the approval for given resource. The endpoint verifies whether a user is authorized to perform a specific action on a given resource within a tenant.\n\nIn case of any validation problems, the below `errorCodes` can be returned:\n  - **APPROVAL-400011**: Requested user is not assigned to any company\n\n***\n**Required scopes**\n* `approval.approval_read_own`\n","operationId":"POST-approval-check-approval","requestBody":{"$ref":"#/components/requestBodies/approvalPermittedRequestBody"},"parameters":[{"$ref":"#/components/parameters/path_tenant"}],"tags":["Approval"]}}}}
```
