{
  "openapi": "3.0.3",
  "info": {
    "title": "Ravi API",
    "version": "1.0.0",
    "description": "Identity provider for AI agents \u2014 provisioned phone numbers, email addresses, TOTP, OTP extraction, and E2E-encrypted passwords and secrets."
  },
  "paths": {
    "/api/secrets/": {
      "get": {
        "operationId": "secrets_list",
        "description": "CRUD for key-value secret entries (API keys, env vars).",
        "parameters": [
          {
            "in": "query",
            "name": "key",
            "schema": {
              "type": "string"
            }
          }
        ],
        "tags": [
          "Secrets"
        ],
        "security": [
          {
            "identityKeyAuth": []
          },
          {
            "managementKeyAuth": []
          },
          {
            "jwtAuth": []
          },
          {
            "cookieAuth": []
          },
          {
            "basicAuth": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SecretEntry"
                  }
                }
              }
            },
            "description": ""
          }
        }
      },
      "post": {
        "operationId": "secrets_create",
        "description": "CRUD for key-value secret entries (API keys, env vars).",
        "tags": [
          "Secrets"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SecretEntryRequest"
              },
              "examples": {
                "CreateSecret": {
                  "value": {
                    "key": "OPENAI_API_KEY",
                    "value": "sk-proj-abc123def456",
                    "notes": "Production key"
                  },
                  "summary": "Create secret"
                }
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/SecretEntryRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/SecretEntryRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "identityKeyAuth": []
          },
          {
            "managementKeyAuth": []
          },
          {
            "jwtAuth": []
          },
          {
            "cookieAuth": []
          },
          {
            "basicAuth": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SecretEntry"
                },
                "examples": {
                  "SecretCreated": {
                    "value": {
                      "uuid": "d4e5f6a7-b8c9-0123-defa-345678901bcd",
                      "identity": 1,
                      "key": "OPENAI_API_KEY",
                      "value": "sk-proj-abc123def456",
                      "notes": "Production key",
                      "created_dt": "2025-06-01T12:00:00Z",
                      "updated_dt": "2025-06-01T12:00:00Z"
                    },
                    "summary": "Secret created"
                  }
                }
              }
            },
            "description": ""
          }
        }
      }
    },
    "/api/secrets/{uuid}/": {
      "get": {
        "operationId": "secrets_retrieve",
        "description": "CRUD for key-value secret entries (API keys, env vars).",
        "parameters": [
          {
            "in": "path",
            "name": "uuid",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true
          }
        ],
        "tags": [
          "Secrets"
        ],
        "security": [
          {
            "identityKeyAuth": []
          },
          {
            "managementKeyAuth": []
          },
          {
            "jwtAuth": []
          },
          {
            "cookieAuth": []
          },
          {
            "basicAuth": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SecretEntry"
                }
              }
            },
            "description": ""
          }
        }
      },
      "put": {
        "operationId": "secrets_update",
        "description": "CRUD for key-value secret entries (API keys, env vars).",
        "parameters": [
          {
            "in": "path",
            "name": "uuid",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true
          }
        ],
        "tags": [
          "Secrets"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SecretEntryRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/SecretEntryRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/SecretEntryRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "identityKeyAuth": []
          },
          {
            "managementKeyAuth": []
          },
          {
            "jwtAuth": []
          },
          {
            "cookieAuth": []
          },
          {
            "basicAuth": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SecretEntry"
                }
              }
            },
            "description": ""
          }
        }
      },
      "patch": {
        "operationId": "secrets_partial_update",
        "description": "CRUD for key-value secret entries (API keys, env vars).",
        "parameters": [
          {
            "in": "path",
            "name": "uuid",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true
          }
        ],
        "tags": [
          "Secrets"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedSecretEntryRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PatchedSecretEntryRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PatchedSecretEntryRequest"
              }
            }
          }
        },
        "security": [
          {
            "identityKeyAuth": []
          },
          {
            "managementKeyAuth": []
          },
          {
            "jwtAuth": []
          },
          {
            "cookieAuth": []
          },
          {
            "basicAuth": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SecretEntry"
                }
              }
            },
            "description": ""
          }
        }
      },
      "delete": {
        "operationId": "secrets_destroy",
        "description": "CRUD for key-value secret entries (API keys, env vars).",
        "parameters": [
          {
            "in": "path",
            "name": "uuid",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true
          }
        ],
        "tags": [
          "Secrets"
        ],
        "security": [
          {
            "identityKeyAuth": []
          },
          {
            "managementKeyAuth": []
          },
          {
            "jwtAuth": []
          },
          {
            "cookieAuth": []
          },
          {
            "basicAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No response body"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "PatchedSecretEntryRequest": {
        "type": "object",
        "description": "Serializer for key-value secret entries.\n\n- identity is optional; the ViewSet defaults it in perform_create().\n- key is stripped, uppercased, and validated against ``^[A-Z][A-Z0-9_]*$``.",
        "properties": {
          "identity": {
            "type": "integer"
          },
          "key": {
            "type": "string",
            "minLength": 1,
            "description": "Plaintext key name, e.g. OPENAI_API_KEY",
            "maxLength": 255
          },
          "value": {
            "type": "string",
            "description": "Secret value"
          },
          "notes": {
            "type": "string",
            "description": "Notes"
          }
        }
      },
      "SecretEntry": {
        "type": "object",
        "description": "Serializer for key-value secret entries.\n\n- identity is optional; the ViewSet defaults it in perform_create().\n- key is stripped, uppercased, and validated against ``^[A-Z][A-Z0-9_]*$``.",
        "properties": {
          "uuid": {
            "type": "string",
            "format": "uuid",
            "readOnly": true
          },
          "identity": {
            "type": "integer"
          },
          "key": {
            "type": "string",
            "description": "Plaintext key name, e.g. OPENAI_API_KEY",
            "maxLength": 255
          },
          "value": {
            "type": "string",
            "description": "Secret value"
          },
          "notes": {
            "type": "string",
            "description": "Notes"
          },
          "created_dt": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_dt": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "created_dt",
          "key",
          "updated_dt",
          "uuid"
        ]
      },
      "SecretEntryRequest": {
        "type": "object",
        "description": "Serializer for key-value secret entries.\n\n- identity is optional; the ViewSet defaults it in perform_create().\n- key is stripped, uppercased, and validated against ``^[A-Z][A-Z0-9_]*$``.",
        "properties": {
          "identity": {
            "type": "integer"
          },
          "key": {
            "type": "string",
            "minLength": 1,
            "description": "Plaintext key name, e.g. OPENAI_API_KEY",
            "maxLength": 255
          },
          "value": {
            "type": "string",
            "description": "Secret value"
          },
          "notes": {
            "type": "string",
            "description": "Notes"
          }
        },
        "required": [
          "key"
        ]
      }
    }
  }
}
