{ "info": { "title": "Animichi Users Service", "version": "0.1.0", "description": "User-domain routes of the TS Users service, consumed by apps/web." }, "components": { "securitySchemes": { "bearerAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "JWT" } } }, "openapi": "3.1.1", "paths": { "/v1/users/saved-routes": { "get": { "operationId": "listSavedRoutes", "summary": "List the caller's saved routes", "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "saved_routes": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "title": { "type": "string" }, "point_ids": { "type": "array", "items": { "type": "string" } }, "status": { "enum": [ "draft", "saved", "completed" ], "type": "string" }, "saved_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "updated_at": { "type": "string" } }, "required": [ "id", "title", "point_ids", "status", "saved_at", "updated_at" ] } } }, "required": [ "saved_routes" ] } } } } }, "security": [ { "bearerAuth": [] } ] }, "post": { "operationId": "saveSavedRoute", "summary": "Create or update a saved route", "description": "Creating a saved route (no id) is retry-safe when an Idempotency-Key is supplied: the key is scoped to the authenticated owner + this operation, so retrying the same key/payload returns the original result, a different payload under the same key returns 409, and concurrent retries create exactly one route.", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "title": { "type": "string", "minLength": 1, "maxLength": 200 }, "point_ids": { "type": "array", "maxItems": 500, "items": { "type": "string", "maxLength": 128 } }, "status": { "enum": [ "draft", "saved", "completed" ], "type": "string", "default": "saved" } }, "required": [ "title", "point_ids" ] } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "title": { "type": "string" }, "point_ids": { "type": "array", "items": { "type": "string" } }, "status": { "enum": [ "draft", "saved", "completed" ], "type": "string" }, "saved_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "updated_at": { "type": "string" } }, "required": [ "id", "title", "point_ids", "status", "saved_at", "updated_at" ] } } } }, "400": { "description": "400", "content": { "application/json": { "schema": { "oneOf": [ { "type": "object", "properties": { "defined": { "const": true }, "code": { "const": "IDEMPOTENCY_KEY_INVALID" }, "status": { "const": 400 }, "message": { "type": "string", "default": "The Idempotency-Key is malformed or too long" }, "data": { "type": "object" } }, "required": [ "defined", "code", "status", "message", "data" ] }, { "type": "object", "properties": { "defined": { "const": false }, "code": { "type": "string" }, "status": { "type": "number" }, "message": { "type": "string" }, "data": {} }, "required": [ "defined", "code", "status", "message" ] } ] } } } }, "403": { "description": "403", "content": { "application/json": { "schema": { "oneOf": [ { "type": "object", "properties": { "defined": { "const": true }, "code": { "const": "SAVED_ROUTE_NOT_OWNED" }, "status": { "const": 403 }, "message": { "type": "string", "default": "Route belongs to another user" }, "data": { "type": "object", "properties": { "saved_route_id": { "type": "string" } }, "required": [ "saved_route_id" ] } }, "required": [ "defined", "code", "status", "message", "data" ] }, { "type": "object", "properties": { "defined": { "const": false }, "code": { "type": "string" }, "status": { "type": "number" }, "message": { "type": "string" }, "data": {} }, "required": [ "defined", "code", "status", "message" ] } ] } } } }, "404": { "description": "404", "content": { "application/json": { "schema": { "oneOf": [ { "type": "object", "properties": { "defined": { "const": true }, "code": { "const": "SAVED_ROUTE_NOT_FOUND" }, "status": { "const": 404 }, "message": { "type": "string", "default": "No such saved route" }, "data": { "type": "object", "properties": { "saved_route_id": { "type": "string" } }, "required": [ "saved_route_id" ] } }, "required": [ "defined", "code", "status", "message", "data" ] }, { "type": "object", "properties": { "defined": { "const": false }, "code": { "type": "string" }, "status": { "type": "number" }, "message": { "type": "string" }, "data": {} }, "required": [ "defined", "code", "status", "message" ] } ] } } } }, "409": { "description": "409", "content": { "application/json": { "schema": { "oneOf": [ { "type": "object", "properties": { "defined": { "const": true }, "code": { "const": "IDEMPOTENCY_CONFLICT" }, "status": { "const": 409 }, "message": { "type": "string", "default": "Idempotency-Key was already used with a different payload" }, "data": { "type": "object" } }, "required": [ "defined", "code", "status", "message", "data" ] }, { "type": "object", "properties": { "defined": { "const": true }, "code": { "const": "IDEMPOTENCY_IN_FLIGHT" }, "status": { "const": 409 }, "message": { "type": "string", "default": "A save with this Idempotency-Key is still in progress; retry shortly" }, "data": { "type": "object" } }, "required": [ "defined", "code", "status", "message", "data" ] }, { "type": "object", "properties": { "defined": { "const": false }, "code": { "type": "string" }, "status": { "type": "number" }, "message": { "type": "string" }, "data": {} }, "required": [ "defined", "code", "status", "message" ] } ] } } } } }, "security": [ { "bearerAuth": [] } ], "parameters": [ { "name": "Idempotency-Key", "in": "header", "description": "Retry-safe SavedRoute creation key, scoped to the authenticated owner + this operation. Same key/payload returns the original result; same key/different payload returns 409; concurrent retries create exactly one route.", "schema": { "type": "string", "maxLength": 128 } } ] } }, "/v1/users/saved-routes/{id}": { "delete": { "operationId": "deleteSavedRoute", "summary": "Delete a saved route", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "deleted": { "const": true } }, "required": [ "deleted" ] } } } }, "403": { "description": "403", "content": { "application/json": { "schema": { "oneOf": [ { "type": "object", "properties": { "defined": { "const": true }, "code": { "const": "SAVED_ROUTE_NOT_OWNED" }, "status": { "const": 403 }, "message": { "type": "string", "default": "Route belongs to another user" }, "data": { "type": "object", "properties": { "saved_route_id": { "type": "string" } }, "required": [ "saved_route_id" ] } }, "required": [ "defined", "code", "status", "message", "data" ] }, { "type": "object", "properties": { "defined": { "const": false }, "code": { "type": "string" }, "status": { "type": "number" }, "message": { "type": "string" }, "data": {} }, "required": [ "defined", "code", "status", "message" ] } ] } } } }, "404": { "description": "404", "content": { "application/json": { "schema": { "oneOf": [ { "type": "object", "properties": { "defined": { "const": true }, "code": { "const": "SAVED_ROUTE_NOT_FOUND" }, "status": { "const": 404 }, "message": { "type": "string", "default": "No such saved route" }, "data": { "type": "object", "properties": { "saved_route_id": { "type": "string" } }, "required": [ "saved_route_id" ] } }, "required": [ "defined", "code", "status", "message", "data" ] }, { "type": "object", "properties": { "defined": { "const": false }, "code": { "type": "string" }, "status": { "type": "number" }, "message": { "type": "string" }, "data": {} }, "required": [ "defined", "code", "status", "message" ] } ] } } } } }, "security": [ { "bearerAuth": [] } ] } } } }