{
 "openapi": "3.1.0",
 "info": {
  "title": "API Clients (Platform)",
  "version": "20261030b",
  "description": "The outside software that holds a key to this company. Every call it makes runs as a named user here, so nothing it can reach is anything that user could not already reach. The key is shown once when it is issued and never again."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "api-clients": {
    "type": "object",
    "required": [
     "code",
     "name"
    ],
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id",
      "readOnly": true
     },
     "org_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org id",
      "readOnly": true
     },
     "code": {
      "type": "string",
      "description": "Client code"
     },
     "name": {
      "type": "string",
      "description": "Name"
     },
     "description": {
      "type": "string",
      "description": "What it is for"
     },
     "key_prefix": {
      "type": "string",
      "description": "Key prefix"
     },
     "key_cipher": {
      "type": "string",
      "description": "Key cipher",
      "readOnly": true
     },
     "key_last4": {
      "type": "string",
      "description": "Key last4",
      "readOnly": true
     },
     "scopes": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "description": "Scopes"
     },
     "rate_limit_per_minute": {
      "type": "integer",
      "description": "Rate limit per minute"
     },
     "allowed_ips": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "description": "Allowed ips"
     },
     "status": {
      "type": "string",
      "description": "Status",
      "enum": [
       "active",
       "suspended",
       "revoked"
      ]
     },
     "expires_at": {
      "type": "string",
      "format": "date-time",
      "description": "Expires"
     },
     "last_used_at": {
      "type": "string",
      "format": "date-time",
      "description": "Last used at",
      "readOnly": true
     },
     "call_count": {
      "type": "string",
      "format": "decimal",
      "description": "Call count",
      "readOnly": true
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Created at",
      "readOnly": true
     },
     "org_unit_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org unit id",
      "readOnly": true
     },
     "protocol": {
      "type": "string",
      "description": "Protocol",
      "enum": [
       "rest",
       "mcp",
       "both"
      ]
     },
     "run_as": {
      "type": "string",
      "format": "uuid",
      "description": "Acts as"
     },
     "software_name": {
      "type": "string",
      "description": "What software is this"
     },
     "contact_email": {
      "type": "string",
      "description": "Who to ask about it"
     },
     "homepage_url": {
      "type": "string",
      "description": "Where it lives"
     },
     "require_allowlist": {
      "type": "boolean",
      "description": "Only from allowed addresses"
     },
     "mcp_instructions": {
      "type": "string",
      "description": "What to tell an MCP client"
     },
     "key_sha256": {
      "type": "string",
      "description": "Key sha256",
      "readOnly": true
     },
     "key_issued_at": {
      "type": "string",
      "format": "date-time",
      "description": "Key issued at",
      "readOnly": true
     },
     "created_by": {
      "type": "string",
      "format": "uuid",
      "description": "Created by",
      "readOnly": true
     },
     "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "Updated at",
      "readOnly": true
     },
     "updated_by": {
      "type": "string",
      "format": "uuid",
      "description": "Updated by",
      "readOnly": true
     },
     "xf_text_1": {
      "type": "string",
      "description": "Xf text 1",
      "readOnly": true
     },
     "xf_text_2": {
      "type": "string",
      "description": "Xf text 2",
      "readOnly": true
     },
     "xf_text_3": {
      "type": "string",
      "description": "Xf text 3",
      "readOnly": true
     },
     "xf_text_4": {
      "type": "string",
      "description": "Xf text 4",
      "readOnly": true
     },
     "xf_text_5": {
      "type": "string",
      "description": "Xf text 5",
      "readOnly": true
     },
     "xf_num_1": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 1",
      "readOnly": true
     },
     "xf_num_2": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 2",
      "readOnly": true
     },
     "xf_num_3": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 3",
      "readOnly": true
     },
     "xf_date_1": {
      "type": "string",
      "format": "date",
      "description": "Xf date 1",
      "readOnly": true
     },
     "xf_date_2": {
      "type": "string",
      "format": "date",
      "description": "Xf date 2",
      "readOnly": true
     }
    }
   }
  }
 },
 "security": [
  {
   "bearer": []
  }
 ],
 "paths": {
  "/api/platform/api-clients": {
   "get": {
    "summary": "list api-clients",
    "operationId": "list_api_clients_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "create api-clients",
    "operationId": "create_api_clients_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/platform/api-clients/{id}": {
   "get": {
    "summary": "get api-clients",
    "operationId": "get_api_clients_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "change api-clients",
    "operationId": "change_api_clients_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "delete api-clients",
    "operationId": "delete_api_clients_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/platform/api-clients/{id}/rotate-key": {
   "post": {
    "summary": "Rotate key",
    "operationId": "action_api_clients_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/platform/api-clients/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_api_clients_0_6",
    "description": "Body keys: overrides, preview, withLines",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  }
 }
}