{
  "generatedFrom": "packages/app4you-contracts/audio/index.ts",
  "operations": {
    "connection": {
      "request": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "properties": {},
        "additionalProperties": false
      },
      "response": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "properties": {
          "email": {
            "type": "string"
          }
        },
        "required": [
          "email"
        ],
        "additionalProperties": false
      }
    },
    "pair": {
      "request": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "site": {
            "type": "string"
          },
          "installationId": {
            "type": "string"
          },
          "siteProof": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "site",
          "installationId",
          "siteProof"
        ],
        "additionalProperties": false
      },
      "response": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "properties": {
          "token": {
            "type": "string"
          }
        },
        "required": [
          "token"
        ],
        "additionalProperties": false
      }
    },
    "revoke": {
      "request": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "properties": {},
        "additionalProperties": false
      },
      "response": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "properties": {
          "revoked": {
            "type": "boolean"
          }
        },
        "required": [
          "revoked"
        ],
        "additionalProperties": false
      }
    },
    "estimate": {
      "request": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "properties": {
          "text": {
            "type": "string"
          },
          "voice": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "optimise": {
            "type": "boolean"
          }
        },
        "required": [
          "text",
          "voice",
          "model",
          "optimise"
        ],
        "additionalProperties": false
      },
      "response": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "properties": {
          "priceMicrocredits": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "reservedMicrocredits": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "characters": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "priceMicrocredits",
          "reservedMicrocredits",
          "characters"
        ],
        "additionalProperties": false
      }
    },
    "voices": {
      "request": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "properties": {
          "search": {
            "type": "string"
          },
          "language": {
            "type": "string"
          },
          "page": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "additionalProperties": false
      },
      "response": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "properties": {
          "voices": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "preview_url": {
                  "type": "string"
                },
                "image_url": {
                  "type": "string"
                },
                "language": {
                  "type": "string"
                },
                "accent": {
                  "type": "string"
                },
                "age": {
                  "type": "string"
                },
                "gender": {
                  "type": "string"
                },
                "rate": {
                  "type": "number",
                  "minimum": 0,
                  "exclusiveMinimum": true,
                  "maximum": 100
                }
              },
              "required": [
                "id",
                "name",
                "preview_url",
                "language",
                "accent",
                "age",
                "gender",
                "rate"
              ],
              "additionalProperties": false
            }
          },
          "hasMore": {
            "type": "boolean"
          },
          "allowedVoiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "voices",
          "hasMore"
        ],
        "additionalProperties": false
      }
    },
    "catalog": {
      "request": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "properties": {},
        "additionalProperties": false
      },
      "response": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "properties": {
          "unit": {
            "type": "string",
            "enum": [
              "audio_credit"
            ]
          },
          "scale": {
            "type": "number",
            "enum": [
              50000
            ]
          },
          "creditsPerUsd": {
            "type": "number",
            "enum": [
              100
            ]
          },
          "configured": {
            "type": "boolean"
          },
          "generationEnabled": {
            "type": "boolean"
          },
          "pricingMode": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "cost_plus"
                ]
              },
              {
                "type": "string",
                "enum": [
                  "fixed"
                ]
              }
            ]
          },
          "testMode": {
            "type": "boolean"
          },
          "termsVersion": {
            "type": "string"
          },
          "tariffVersion": {
            "type": "string"
          },
          "maxCharacters": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "modelRatesMicrocreditsPer1000": {
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            }
          },
          "optimiseMicrocreditsPer1000": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "voices": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "name"
              ],
              "additionalProperties": false
            }
          },
          "packages": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "credits": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "amountCents": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "currency": {
                  "type": "string",
                  "enum": [
                    "usd",
                    "pln"
                  ]
                }
              },
              "required": [
                "id",
                "label",
                "credits",
                "amountCents",
                "currency"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "unit",
          "scale",
          "creditsPerUsd",
          "configured",
          "testMode",
          "termsVersion",
          "tariffVersion",
          "maxCharacters",
          "modelRatesMicrocreditsPer1000",
          "optimiseMicrocreditsPer1000",
          "voices",
          "packages"
        ],
        "additionalProperties": false
      }
    },
    "balance": {
      "request": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "properties": {},
        "additionalProperties": false
      },
      "response": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "properties": {
          "unit": {
            "type": "string",
            "enum": [
              "audio_credit"
            ]
          },
          "scale": {
            "type": "number",
            "enum": [
              50000
            ]
          },
          "creditsPerUsd": {
            "type": "number",
            "enum": [
              100
            ]
          },
          "availableMicrocredits": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "heldMicrocredits": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "totalMicrocredits": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "testMode": {
            "type": "boolean"
          }
        },
        "required": [
          "unit",
          "scale",
          "creditsPerUsd",
          "availableMicrocredits",
          "heldMicrocredits",
          "totalMicrocredits",
          "testMode"
        ],
        "additionalProperties": false
      }
    },
    "activity": {
      "request": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "properties": {
          "cursor": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "response": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "properties": {
          "entries": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "kind": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "credit"
                      ]
                    },
                    {
                      "type": "string",
                      "enum": [
                        "debit"
                      ]
                    },
                    {
                      "type": "string",
                      "enum": [
                        "refund"
                      ]
                    },
                    {
                      "type": "string",
                      "enum": [
                        "expiry"
                      ]
                    }
                  ]
                },
                "amountMicrocredits": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "createdAt": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "productId": {
                  "type": "string"
                },
                "siteUrl": {
                  "type": "string"
                },
                "purpose": {
                  "type": "string"
                },
                "operationId": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "kind",
                "amountMicrocredits",
                "createdAt"
              ],
              "additionalProperties": false
            }
          },
          "cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "hasMore": {
            "type": "boolean"
          }
        },
        "required": [
          "entries",
          "cursor",
          "hasMore"
        ],
        "additionalProperties": false
      }
    },
    "quotes": {
      "request": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "properties": {
          "text": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "voice": {
            "type": "string"
          },
          "optimise": {
            "type": "boolean"
          }
        },
        "required": [
          "text",
          "model",
          "voice",
          "optimise"
        ],
        "additionalProperties": false
      },
      "response": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9]{20,64}$"
          },
          "priceMicrocredits": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "characters": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "unit": {
            "type": "string",
            "enum": [
              "audio_credit"
            ]
          },
          "scale": {
            "type": "number",
            "enum": [
              50000
            ]
          },
          "creditsPerUsd": {
            "type": "number",
            "enum": [
              100
            ]
          },
          "rateVersion": {
            "type": "string"
          },
          "expiresIn": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "id",
          "priceMicrocredits",
          "characters",
          "unit",
          "scale",
          "creditsPerUsd",
          "rateVersion",
          "expiresIn"
        ],
        "additionalProperties": false
      }
    },
    "jobs": {
      "request": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "properties": {
          "quoteId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9]{20,64}$"
          },
          "confirmedMicrocredits": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "quoteId",
          "confirmedMicrocredits"
        ],
        "additionalProperties": false
      },
      "response": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9]{20,64}$"
          },
          "state": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "queued"
                ]
              },
              {
                "type": "string",
                "enum": [
                  "running"
                ]
              },
              {
                "type": "string",
                "enum": [
                  "succeeded"
                ]
              },
              {
                "type": "string",
                "enum": [
                  "failed"
                ]
              },
              {
                "type": "string",
                "enum": [
                  "uncertain"
                ]
              }
            ]
          }
        },
        "required": [
          "id",
          "state"
        ],
        "additionalProperties": false
      }
    },
    "status": {
      "request": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "properties": {},
        "additionalProperties": false
      },
      "response": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9]{20,64}$"
          },
          "state": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "queued"
                ]
              },
              {
                "type": "string",
                "enum": [
                  "running"
                ]
              },
              {
                "type": "string",
                "enum": [
                  "succeeded"
                ]
              },
              {
                "type": "string",
                "enum": [
                  "failed"
                ]
              },
              {
                "type": "string",
                "enum": [
                  "uncertain"
                ]
              }
            ]
          },
          "priceMicrocredits": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "unit": {
            "type": "string",
            "enum": [
              "audio_credit"
            ]
          },
          "scale": {
            "type": "number",
            "enum": [
              50000
            ]
          },
          "creditsPerUsd": {
            "type": "number",
            "enum": [
              100
            ]
          },
          "error_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "expires_at": {
            "type": "string"
          },
          "text_sha256": {
            "type": [
              "string",
              "null"
            ]
          },
          "completed_at": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "state",
          "priceMicrocredits",
          "unit",
          "scale",
          "creditsPerUsd",
          "error_code",
          "expires_at",
          "text_sha256",
          "completed_at"
        ],
        "additionalProperties": false
      }
    },
    "checkout": {
      "request": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "properties": {
          "packageId": {
            "type": "string"
          },
          "termsVersion": {
            "type": "string"
          },
          "termsAccepted": {
            "type": "boolean"
          },
          "immediateService": {
            "type": "boolean"
          },
          "returnUrl": {
            "type": "string"
          }
        },
        "required": [
          "packageId",
          "termsVersion",
          "termsAccepted",
          "immediateService"
        ],
        "additionalProperties": false
      },
      "response": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9]{20,64}$"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "url"
        ],
        "additionalProperties": false
      }
    }
  },
  "error": {
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "properties": {
      "error": {
        "type": "string",
        "enum": [
          "audio_request_failed",
          "unauthorized",
          "forbidden",
          "audio_account_frozen",
          "connection_revoked",
          "site_proof_required",
          "site_proof_failed",
          "site_proof_invalid_address",
          "site_proof_invalid_url",
          "not_found",
          "account_not_found",
          "connection_not_found",
          "audio_job_not_found",
          "audio_quote_not_found",
          "audio_request_not_found",
          "audio_payment_not_found",
          "audio_unavailable",
          "payment_unavailable",
          "request_too_large",
          "audio_too_many_requests",
          "audio_provider_quota_exceeded",
          "too_many_pair_codes",
          "idempotency_conflict",
          "insufficient_audio_credits",
          "audio_quote_already_used",
          "audio_quote_expired",
          "audio_quote_price_changed",
          "audio_model_configuration_changed",
          "audio_credit_hold_closed",
          "audio_hold_closed",
          "audio_job_review_conflict",
          "audio_request_review_conflict",
          "audio_payment_already_credited",
          "audio_payment_already_paid",
          "audio_payment_mismatch",
          "audio_payment_mode_mismatch",
          "audio_provider_call_inflight",
          "audio_provider_funding_inflight",
          "stale_audio_lease",
          "provider_call_already_attempted",
          "preview_expired",
          "audio_checkout_not_configured",
          "audio_credit_package_not_configured",
          "audio_credit_tariff_not_configured",
          "audio_encryption_not_configured",
          "audio_provider_not_configured",
          "audio_provider_pricing_not_configured",
          "audio_provider_service_paused",
          "audio_voice_catalog_unavailable",
          "audio_voice_library_requires_paid_plan",
          "billing_unavailable",
          "elevenlabs_rate_not_configured",
          "openai_rate_not_configured",
          "audio_funding_revenue_limit",
          "audio_reconciliation_required",
          "audio_payment_reconciliation_required",
          "audio_provider_usage_required",
          "audio_payment_customer_missing",
          "invalid_audio_request",
          "invalid_json",
          "invalid_json_content_type",
          "invalid_pairing_code",
          "invalid_connection",
          "invalid_site_url",
          "invalid_cursor",
          "invalid_month",
          "invalid_narration_input",
          "invalid_voice_search",
          "unsupported_audio_model",
          "unsupported_audio_voice",
          "cloud_consent_required",
          "service_start_consent_required",
          "audio_terms_required",
          "invalid_audio_terms",
          "invalid_audio_credit_package",
          "invalid_audio_reference",
          "invalid_return_url"
        ]
      }
    },
    "required": [
      "error"
    ],
    "additionalProperties": false
  }
}
