{"openapi":"3.0.3","info":{"title":"E-CARTE BUSINESS API","version":"1.0.0","description":"Versioned REST API. Authenticate with `Authorization: Bearer ecb_…` (tokens are created in Workspace → API). 120 requests/minute per token. Send `Idempotency-Key` on POST to safely retry."},"servers":[{"url":"https://business.e-carte.ma/api/v1"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}},"schemas":{"Employee":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"employee_code":{"type":"string","nullable":true},"first_name":{"type":"string"},"last_name":{"type":"string"},"title":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"whatsapp":{"type":"string","nullable":true},"branch":{"type":"string","nullable":true},"department":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","inactive","left"]},"card_url":{"type":"string","nullable":true}}},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"status":{"type":"integer"},"message":{"type":"string"},"fields":{"type":"object","additionalProperties":{"type":"string"}}}}}}},"responses":{"Error":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/me":{"get":{"summary":"Token owner, company and scopes","responses":{"200":{"description":"OK"},"401":{"$ref":"#/components/responses/Error"}}}},"/company":{"get":{"summary":"Company profile","description":"Scope: `company.manage`","responses":{"200":{"description":"OK"},"403":{"$ref":"#/components/responses/Error"}}}},"/branches":{"get":{"summary":"List branches","responses":{"200":{"description":"OK"}}}},"/departments":{"get":{"summary":"List departments","responses":{"200":{"description":"OK"}}}},"/employees":{"get":{"summary":"List employees","description":"Scope: `employees.view`","parameters":[{"name":"page","in":"query","schema":{"type":"integer","minimum":1}},{"name":"per_page","in":"query","schema":{"type":"integer","maximum":200}},{"name":"status","in":"query","schema":{"type":"string","enum":["active","inactive","left"]}},{"name":"search","in":"query","schema":{"type":"string"}},{"name":"updated_since","in":"query","schema":{"type":"string","format":"date-time"}},{"name":"sort","in":"query","schema":{"type":"string","enum":["name","created_at","-created_at","updated_at","-updated_at"]}}],"responses":{"200":{"description":"OK — `{data:[], meta:{page, per_page, total, pages}}`"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"post":{"summary":"Create employee (+ draft or published card)","description":"Scope: `employees.manage`","parameters":[{"name":"Idempotency-Key","in":"header","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["first_name","last_name"],"properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"title":{"type":"string"},"employee_code":{"type":"string"},"branch_id":{"type":"integer"},"department_id":{"type":"integer"},"publish_card":{"type":"boolean"}}}}}},"responses":{"201":{"description":"Created"},"422":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"}}}},"/employees/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"summary":"Get employee","responses":{"200":{"description":"OK"},"404":{"$ref":"#/components/responses/Error"}}},"patch":{"summary":"Update employee fields","description":"Scope: `employees.manage`","responses":{"200":{"description":"OK"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}}},"delete":{"summary":"Deactivate employee (data kept)","description":"Scope: `employees.manage`","responses":{"200":{"description":"OK"}}}},"/cards":{"get":{"summary":"List digital cards","description":"Scope: `cards.view`","parameters":[{"name":"page","in":"query","schema":{"type":"integer","minimum":1}},{"name":"per_page","in":"query","schema":{"type":"integer","maximum":200}}],"responses":{"200":{"description":"OK — `{data:[], meta:{page, per_page, total, pages}}`"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/nfc-cards":{"get":{"summary":"List NFC cards of the company","description":"Scope: `nfc.view`","parameters":[{"name":"page","in":"query","schema":{"type":"integer","minimum":1}},{"name":"per_page","in":"query","schema":{"type":"integer","maximum":200}}],"responses":{"200":{"description":"OK — `{data:[], meta:{page, per_page, total, pages}}`"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/qr-codes":{"get":{"summary":"List QR codes","description":"Scope: `qr.view`","parameters":[{"name":"page","in":"query","schema":{"type":"integer","minimum":1}},{"name":"per_page","in":"query","schema":{"type":"integer","maximum":200}}],"responses":{"200":{"description":"OK — `{data:[], meta:{page, per_page, total, pages}}`"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/analytics/summary":{"get":{"summary":"Analytics summary","description":"Scope: `analytics.view`","parameters":[{"name":"from","in":"query","schema":{"type":"string","format":"date"}},{"name":"to","in":"query","schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"OK"}}}},"/subscription":{"get":{"summary":"Subscription and seat usage","responses":{"200":{"description":"OK"}}}}}}