{"components":{"responses":{},"schemas":{"Category":{"nullable":true,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"},"slug":{"type":"string"}},"title":"Category","type":"object"},"DiscountCode":{"description":"A discount code belonging to the authenticated user","example":{"active_from":"2026-06-01T00:00:00Z","active_to":"2026-08-31T23:59:59Z","amount":"10","brand":"Studio Wren","category":{"id":"3b1f2c74-7c1a-4e2f-9c2d-2f1b6a8e4d10","name":"Fashion","slug":"fashion"},"code":"SUMMER10","country":"IT","currency":null,"description":"10% off the summer collection","icon":"tag","id":"0f8fad5b-d9cb-469f-a165-70867728950e","image_url":null,"inserted_at":"2026-05-20T09:12:33Z","position":1,"type":"percentage","updated_at":"2026-05-20T09:12:33Z","url":"https://studiowren.example/shop","visibility":"public"},"properties":{"active_from":{"format":"date-time","nullable":true,"type":"string"},"active_to":{"format":"date-time","nullable":true,"type":"string"},"amount":{"description":"Decimal amount, e.g. \"10\" or \"9.99\"","type":"string"},"brand":{"type":"string"},"category":{"$ref":"#/components/schemas/Category"},"code":{"example":"SUMMER10","type":"string"},"country":{"description":"ISO 3166-1 alpha-2","nullable":true,"type":"string"},"currency":{"description":"ISO 4217 currency code, only set when type is \"value\"","nullable":true,"type":"string"},"description":{"nullable":true,"type":"string"},"icon":{"type":"string"},"id":{"format":"uuid","type":"string"},"image_url":{"nullable":true,"type":"string"},"inserted_at":{"format":"date-time","type":"string"},"position":{"type":"integer"},"type":{"enum":["percentage","value"],"type":"string"},"updated_at":{"format":"date-time","type":"string"},"url":{"nullable":true,"type":"string"},"visibility":{"enum":["public","logged_in","followers"],"type":"string"}},"required":["id","code","type","amount","brand","visibility","position"],"title":"DiscountCode","type":"object"},"DiscountCodeListResponse":{"properties":{"data":{"items":{"$ref":"#/components/schemas/DiscountCode"},"type":"array"}},"required":["data"],"title":"DiscountCodeListResponse","type":"object"},"DiscountCodeRequest":{"description":"Request body for creating or updating a discount code","example":{"active_from":"2026-06-01T00:00:00Z","active_to":"2026-08-31T23:59:59Z","amount":"10","brand":"Studio Wren","code":"SUMMER10","description":"10% off the summer collection","type":"percentage","url":"https://studiowren.example/shop","visibility":"public"},"properties":{"active_from":{"format":"date-time","nullable":true,"type":"string"},"active_to":{"format":"date-time","nullable":true,"type":"string"},"amount":{"type":"string"},"brand":{"type":"string"},"category_id":{"format":"uuid","nullable":true,"type":"string"},"code":{"example":"SUMMER10","type":"string"},"country":{"nullable":true,"type":"string"},"currency":{"nullable":true,"type":"string"},"description":{"nullable":true,"type":"string"},"icon":{"type":"string"},"type":{"enum":["percentage","value"],"type":"string"},"url":{"nullable":true,"type":"string"},"visibility":{"enum":["public","logged_in","followers"],"type":"string"}},"required":["code","type","amount","brand"],"title":"DiscountCodeRequest","type":"object"},"DiscountCodeResponse":{"properties":{"data":{"$ref":"#/components/schemas/DiscountCode"}},"required":["data"],"title":"DiscountCodeResponse","type":"object"},"ErrorResponse":{"example":{"error":{"code":"validation_error","details":{"amount":["must be greater than 0"]},"message":"Validation failed"}},"properties":{"error":{"properties":{"code":{"description":"Stable machine-readable code. Branch on this, not on `message`.","enum":["unauthorized","forbidden","not_found","validation_error","max_codes_reached","rate_limited"],"example":"validation_error","type":"string"},"details":{"description":"Field-level errors, when the code is validation_error","nullable":true,"type":"object"},"message":{"type":"string"}},"required":["code","message"],"type":"object"}},"required":["error"],"title":"ErrorResponse","type":"object"}},"securitySchemes":{"bearer_auth":{"bearerFormat":"opaque token","description":"A personal access token created in Settings > API Tokens.\nSend it as `Authorization: Bearer <token>`.\nEach token carries specific scopes (e.g. `discount_codes:read`,\n`discount_codes:write`) — see each operation's description for\nthe scope it requires.\n","scheme":"bearer","type":"http"}}},"info":{"description":"The Brila public API.\n\n[Brila](https://brila.me) is a free link-in-bio platform for creators\nand brands: one page at `brila.me/<username>` that gathers their social\nlinks, their discount codes, and Instagram automations that auto-reply\nto DMs and comments.\n\nThis API lets an account manage **its own** discount codes\nprogrammatically. It is not a directory or a search API — a token only\never reaches the data of the account that issued it.\n\n## Authentication\n\nCreate a personal access token in **Settings → API Tokens** at\nhttps://brila.me/settings/api-tokens, then send it on every request:\n\n    Authorization: Bearer brla_mgcBOuYvXlBRij2hg7vN-ghyWdIA8UhZ9MiWDlfg-4Y\n\nTokens are 48 characters: the prefix `brla_` followed by 43 URL-safe\nbase64 characters (32 random bytes, unpadded).\nThe full token is shown **once, at creation** — only a hash is stored,\nso it cannot be retrieved afterwards. If it is lost, revoke it and\ncreate another.\n\nA token can expire after 30, 60, 90 or 365 days, or never; the default\nis 90 days. An expired or revoked token returns `401` exactly like an\ninvalid one, so a long-running integration should treat a sudden `401`\nas \"this token has ended\" rather than as a transient failure to retry.\n\nEach token carries explicit scopes. An operation's description names\nthe scope it needs; calling without it returns `403` with a\n`forbidden` error rather than an empty result.\n\n## Rate limits\n\nPer token, in a rolling 5-minute window: **300 reads** and **60 writes**,\nbudgeted separately so read traffic cannot exhaust the write allowance.\nExceeding either returns `429` with a `Retry-After` header.\n\n## Errors\n\nFailures return a JSON body with a stable machine-readable `error.code`\nand a human-readable `error.message`. Branch on the code, not the\nmessage. Codes in use: `unauthorized` (401), `forbidden` (403),\n`not_found` (404), `validation_error` (422), `max_codes_reached` (422)\nand `rate_limited` (429).\n","title":"Brila API","version":"1"},"openapi":"3.0.0","paths":{"/api/v1/discount_codes":{"get":{"callbacks":{},"description":"Requires the `discount_codes:read` scope.","operationId":"listDiscountCodes","parameters":[],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DiscountCodeListResponse"}}},"description":"Discount codes"}},"summary":"List discount codes","tags":["Discount Codes"]},"post":{"callbacks":{},"description":"Requires the `discount_codes:write` scope.","operationId":"createDiscountCode","parameters":[],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DiscountCodeRequest"}}},"description":"Discount code params","required":false},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DiscountCodeResponse"}}},"description":"Discount code"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Validation error"}},"summary":"Create a discount code","tags":["Discount Codes"]}},"/api/v1/discount_codes/{id}":{"delete":{"callbacks":{},"description":"Requires the `discount_codes:write` scope. Soft-deletes the code.","operationId":"deleteDiscountCode","parameters":[{"description":"Discount code ID","in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Deleted"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not found"}},"summary":"Delete a discount code","tags":["Discount Codes"]},"get":{"callbacks":{},"description":"Requires the `discount_codes:read` scope.","operationId":"getDiscountCode","parameters":[{"description":"Discount code ID","in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DiscountCodeResponse"}}},"description":"Discount code"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not found"}},"summary":"Get a discount code","tags":["Discount Codes"]},"put":{"callbacks":{},"description":"Requires the `discount_codes:write` scope.","operationId":"updateDiscountCode","parameters":[{"description":"Discount code ID","in":"path","name":"id","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DiscountCodeRequest"}}},"description":"Discount code params","required":false},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DiscountCodeResponse"}}},"description":"Discount code"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not found"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Validation error"}},"summary":"Update a discount code","tags":["Discount Codes"]}}},"security":[{"bearer_auth":[]}],"servers":[{"url":"https://brila.me","variables":{}}],"tags":[]}