{"openapi":"3.1.0","info":{"title":"YourTrend API","version":"1.0.0","description":"API-first platform for email delivery (yourtrend.online) and secure mail (i.yourtrend.online)."},"servers":[{"url":"https:\/\/api.yourtrend.online\/api\/v1","description":"Production"},{"url":"http:\/\/127.0.0.1:18080\/api\/v1","description":"Local dev"}],"security":[{"ApiKey":[]}],"components":{"securitySchemes":{"ApiKey":{"type":"http","scheme":"bearer","description":"Scoped API key: Authorization: Bearer yt_{env}_{prefix}.{secret}"},"UserToken":{"type":"http","scheme":"bearer","description":"Astrina-issued user session token (Sanctum)."}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"}},"required":["code","message"]}}},"Domain":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"domain":{"type":"string"},"type":{"type":"string","enum":["sending","inbound","both"]},"verification_status":{"type":"string","enum":["pending","verified","failed"]},"checks":{"type":"object","properties":{"spf":{"type":"boolean"},"dkim":{"type":"boolean"},"dmarc":{"type":"boolean"},"mx":{"type":"boolean"}}},"dns_records":{"type":"object"}}},"Identity":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"owned_domain_id":{"type":"string","format":"uuid"},"email_address":{"type":"string","format":"email"},"display_name":{"type":"string","nullable":true},"from_header":{"type":"string"},"priority":{"type":"integer"},"active":{"type":"boolean"}}},"ApiKey":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"prefix":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"environment":{"type":"string","enum":["live","test"]},"token":{"type":"string","description":"Returned only once, on create."}}}}},"paths":{"\/health":{"get":{"summary":"Liveness\/health","security":[],"responses":{"200":{"description":"OK"}}}},"\/whoami":{"get":{"summary":"Echo the authenticated tenant + key scopes","responses":{"200":{"description":"OK"},"401":{"description":"Unauthorized","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/usage":{"get":{"summary":"Current quotas: emails per day\/month, resource counts, balance","description":"A null limit means unlimited \u2014 remaining is then null, not 0.","security":[{"ApiKey":["messages:read"]}],"responses":{"200":{"description":"OK"},"401":{"description":"Unauthorized","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/domains":{"get":{"summary":"List domains","security":[{"ApiKey":["domains:read"]}],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Add a domain (auto DKIM + DNS records)","security":[{"ApiKey":["domains:write"]}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["domain"],"properties":{"domain":{"type":"string"},"type":{"type":"string"}}}}}},"responses":{"201":{"description":"Created","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/Domain"}}}}}},"422":{"description":"Validation failed","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/domains\/{id}":{"get":{"summary":"Get a domain","security":[{"ApiKey":["domains:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/Domain"}}}}}},"404":{"description":"Not found","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}},"delete":{"summary":"Delete a domain","security":[{"ApiKey":["domains:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Deleted"}}}},"\/domains\/{id}\/verify":{"post":{"summary":"Verify a domain via DNS","security":[{"ApiKey":["domains:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/Domain"}}}}}}}}},"\/identities":{"get":{"summary":"List identities","security":[{"ApiKey":["identities:read"]}],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Create an identity (sender address \/ project)","security":[{"ApiKey":["identities:write"]}],"responses":{"201":{"description":"Created","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/Identity"}}}}}},"422":{"description":"Validation failed","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/identities\/{id}":{"get":{"summary":"Get identity","security":[{"ApiKey":["identities:read"]}],"responses":{"200":{"description":"OK"}}},"put":{"summary":"Update identity","security":[{"ApiKey":["identities:write"]}],"responses":{"200":{"description":"OK"}}},"delete":{"summary":"Delete identity","security":[{"ApiKey":["identities:write"]}],"responses":{"204":{"description":"Deleted"}}}},"\/api-keys":{"get":{"summary":"List API keys","security":[{"ApiKey":["apikeys:read"]}],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Create an API key (token shown once)","security":[{"ApiKey":["apikeys:write"]}],"responses":{"201":{"description":"Created","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/ApiKey"}}}}}}}}},"\/api-keys\/{id}":{"delete":{"summary":"Revoke API key","security":[{"ApiKey":["apikeys:write"]}],"responses":{"204":{"description":"Revoked"}}}}}}