Dyno Phi
ContentsHTTP APIShow

Billing

Read the balance, buy credits, and set auto-reload and the monthly spend limit.

GET /v1/billing

Get billing overview

bash
curl -H "x-api-key: $PHI_KEY" https://api.dynophi.com/v1/billing

Parameters

NameTypeDefault
refreshquery, optionalbooleanfalse

200 response (application/json)

200 response fields and schemaShow

Fields

NameTypeDefault
organization_idrequiredstring
providerrequiredstring
planrequiredstring
credit_price_centsrequiredinteger
balancerequiredobject
auto_reloadrequiredobject
presetsrequired(object)[]
packsrequired(object)[]
payment_method_savedrequiredboolean
payment_methodoptionalobject or null
portal_availablerequiredboolean
payment_methodsoptional(object)[] or null[]
billing_detailsoptionalobject or null
spend_limitoptionalobject or null
JSON schema
{
  "$ref": "#/$defs/BillingResponse",
  "$defs": {
    "BalanceResponse": {
      "type": "object",
      "required": [
        "allowance",
        "allowance_available",
        "purchased",
        "total_available",
        "reset_at"
      ],
      "properties": {
        "allowance": {
          "type": "integer"
        },
        "allowance_available": {
          "type": "integer"
        },
        "purchased": {
          "type": "integer"
        },
        "total_available": {
          "type": "integer"
        },
        "reset_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "AutoReloadResponse": {
      "type": "object",
      "required": [
        "enabled",
        "threshold_credits",
        "amount_cents",
        "monthly_cap_cents",
        "disabled_reason",
        "this_month_cents"
      ],
      "properties": {
        "enabled": {
          "type": "boolean"
        },
        "threshold_credits": {
          "type": "integer"
        },
        "amount_cents": {
          "type": "integer"
        },
        "monthly_cap_cents": {
          "type": "integer"
        },
        "disabled_reason": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "this_month_cents": {
          "type": "integer"
        }
      }
    },
    "PresetResponse": {
      "type": "object",
      "required": [
        "amount_cents",
        "credits"
      ],
      "properties": {
        "amount_cents": {
          "type": "integer"
        },
        "credits": {
          "type": "integer"
        }
      }
    },
    "PackResponse": {
      "type": "object",
      "required": [
        "slug",
        "display_name",
        "credits",
        "amount_cents"
      ],
      "properties": {
        "slug": {
          "type": "string"
        },
        "display_name": {
          "type": "string"
        },
        "credits": {
          "type": "integer"
        },
        "amount_cents": {
          "type": "integer"
        }
      }
    },
    "PaymentMethodResponse": {
      "type": "object",
      "required": [
        "brand",
        "last4",
        "exp_month",
        "exp_year"
      ],
      "properties": {
        "brand": {
          "type": "string"
        },
        "last4": {
          "type": "string"
        },
        "exp_month": {
          "type": "integer"
        },
        "exp_year": {
          "type": "integer"
        }
      }
    },
    "SavedMethodResponse": {
      "type": "object",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "type": "string"
        },
        "brand": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "last4": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "exp_month": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ]
        },
        "exp_year": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ]
        },
        "default": {
          "type": "boolean",
          "default": false
        },
        "wallet": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "email": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "AddressResponse": {
      "type": "object",
      "properties": {
        "line1": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "line2": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "city": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "state": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "postal_code": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "country": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "TaxIdResponse": {
      "type": "object",
      "required": [
        "type",
        "value"
      ],
      "properties": {
        "type": {
          "type": "string"
        },
        "value": {
          "type": "string"
        }
      }
    },
    "BillingDetailsResponse": {
      "type": "object",
      "properties": {
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "email": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "address": {
          "anyOf": [
            {
              "$ref": "#/$defs/AddressResponse"
            },
            {
              "type": "null"
            }
          ]
        },
        "tax_ids": {
          "type": "array",
          "default": [],
          "items": {
            "$ref": "#/$defs/TaxIdResponse"
          }
        }
      }
    },
    "SpendLimitResponse": {
      "type": "object",
      "required": [
        "monthly_credits",
        "notify_percent",
        "used_this_month"
      ],
      "properties": {
        "monthly_credits": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ]
        },
        "notify_percent": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ]
        },
        "used_this_month": {
          "type": "integer"
        }
      }
    },
    "BillingResponse": {
      "type": "object",
      "required": [
        "organization_id",
        "provider",
        "plan",
        "credit_price_cents",
        "balance",
        "auto_reload",
        "presets",
        "packs",
        "payment_method_saved",
        "portal_available"
      ],
      "properties": {
        "organization_id": {
          "type": "string"
        },
        "provider": {
          "type": "string"
        },
        "plan": {
          "type": "string"
        },
        "credit_price_cents": {
          "type": "integer"
        },
        "balance": {
          "$ref": "#/$defs/BalanceResponse"
        },
        "auto_reload": {
          "$ref": "#/$defs/AutoReloadResponse"
        },
        "presets": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PresetResponse"
          }
        },
        "packs": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PackResponse"
          }
        },
        "payment_method_saved": {
          "type": "boolean"
        },
        "payment_method": {
          "anyOf": [
            {
              "$ref": "#/$defs/PaymentMethodResponse"
            },
            {
              "type": "null"
            }
          ]
        },
        "portal_available": {
          "type": "boolean"
        },
        "payment_methods": {
          "default": [],
          "anyOf": [
            {
              "type": "array",
              "items": {
                "$ref": "#/$defs/SavedMethodResponse"
              }
            },
            {
              "type": "null"
            }
          ]
        },
        "billing_details": {
          "anyOf": [
            {
              "$ref": "#/$defs/BillingDetailsResponse"
            },
            {
              "type": "null"
            }
          ]
        },
        "spend_limit": {
          "anyOf": [
            {
              "$ref": "#/$defs/SpendLimitResponse"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    }
  }
}

Illustrative response shape. Values are placeholders, not a recorded result.

json
{
  "organization_id": "<value>",
  "provider": "<value>",
  "plan": "<value>",
  "credit_price_cents": 0,
  "balance": {
    "allowance": 0,
    "allowance_available": 0,
    "purchased": 0,
    "total_available": 0,
    "reset_at": "<value>"
  },
  "auto_reload": {
    "enabled": false,
    "threshold_credits": 0,
    "amount_cents": 0,
    "monthly_cap_cents": 0,
    "disabled_reason": "<value>",
    "this_month_cents": 0
  },
  "presets": [
    {
      "amount_cents": 0,
      "credits": 0
    }
  ],
  "packs": [
    {
      "slug": "<value>",
      "display_name": "<value>",
      "credits": 0,
      "amount_cents": 0
    }
  ],
  "payment_method_saved": false,
  "payment_method": {
    "brand": "<value>",
    "last4": "<value>",
    "exp_month": 0,
    "exp_year": 0
  },
  "portal_available": false,
  "payment_methods": [],
  "billing_details": {
    "name": "<value>",
    "email": "<value>",
    "address": {
      "line1": "<value>",
      "line2": "<value>",
      "city": "<value>",
      "state": "<value>",
      "postal_code": "<value>",
      "country": "<value>"
    },
    "tax_ids": []
  },
  "spend_limit": {
    "monthly_credits": 0,
    "notify_percent": 0,
    "used_this_month": 0
  }
}

Returns 200 or 422.

PUT /v1/billing/auto-reload

Change auto-reload

Only an organization admin can use this.

bash
curl -H "x-api-key: $PHI_KEY" -X PUT https://api.dynophi.com/v1/billing/auto-reload \
  -H "content-type: application/json" \
  -d '{
  "enabled": "<enabled>",
  "threshold_credits": "<threshold_credits>",
  "amount_cents": "<amount_cents>",
  "monthly_cap_cents": "<monthly_cap_cents>"
}'

Body

NameTypeDescription
enabledrequiredboolean
threshold_creditsrequiredintegerminimum: 0
amount_centsrequiredintegergreater than: 0
monthly_cap_centsrequiredintegergreater than: 0
Complete request schemaShow

Fields

NameTypeDescription
enabledrequiredboolean
threshold_creditsrequiredintegerminimum: 0
amount_centsrequiredintegergreater than: 0
monthly_cap_centsrequiredintegergreater than: 0
JSON schema
{
  "$ref": "#/$defs/AutoReloadRequest",
  "$defs": {
    "AutoReloadRequest": {
      "type": "object",
      "required": [
        "enabled",
        "threshold_credits",
        "amount_cents",
        "monthly_cap_cents"
      ],
      "properties": {
        "enabled": {
          "type": "boolean"
        },
        "threshold_credits": {
          "type": "integer",
          "minimum": 0
        },
        "amount_cents": {
          "type": "integer",
          "exclusiveMinimum": 0
        },
        "monthly_cap_cents": {
          "type": "integer",
          "exclusiveMinimum": 0
        }
      }
    }
  }
}

200 response (application/json)

200 response fields and schemaShow

Fields

NameType
enabledrequiredboolean
threshold_creditsrequiredinteger
amount_centsrequiredinteger
monthly_cap_centsrequiredinteger
disabled_reasonrequiredstring or null
this_month_centsrequiredinteger
JSON schema
{
  "$ref": "#/$defs/AutoReloadResponse",
  "$defs": {
    "AutoReloadResponse": {
      "type": "object",
      "required": [
        "enabled",
        "threshold_credits",
        "amount_cents",
        "monthly_cap_cents",
        "disabled_reason",
        "this_month_cents"
      ],
      "properties": {
        "enabled": {
          "type": "boolean"
        },
        "threshold_credits": {
          "type": "integer"
        },
        "amount_cents": {
          "type": "integer"
        },
        "monthly_cap_cents": {
          "type": "integer"
        },
        "disabled_reason": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "this_month_cents": {
          "type": "integer"
        }
      }
    }
  }
}

Illustrative response shape. Values are placeholders, not a recorded result.

json
{
  "enabled": false,
  "threshold_credits": 0,
  "amount_cents": 0,
  "monthly_cap_cents": 0,
  "disabled_reason": "<value>",
  "this_month_cents": 0
}

Returns 200 or 422.

GET /v1/billing/loads

List loads

bash
curl -H "x-api-key: $PHI_KEY" https://api.dynophi.com/v1/billing/loads

Parameters

NameTypeDefaultDescription
limitquery, optionalinteger20minimum: 1; maximum: 100

200 response (application/json)

200 response fields and schemaShow
JSON schema
{
  "type": "array",
  "items": {
    "$ref": "#/$defs/LoadResponse"
  },
  "$defs": {
    "PaidWithResponse": {
      "type": "object",
      "properties": {
        "brand": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "last4": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "LoadResponse": {
      "type": "object",
      "required": [
        "id",
        "kind",
        "amount_cents",
        "credits",
        "status",
        "provider_ref",
        "error",
        "created_at",
        "settled_at"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "kind": {
          "type": "string",
          "enum": [
            "load",
            "auto"
          ]
        },
        "amount_cents": {
          "type": "integer"
        },
        "credits": {
          "type": "integer"
        },
        "status": {
          "type": "string",
          "enum": [
            "pending",
            "charged",
            "credited",
            "failed"
          ]
        },
        "provider_ref": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "created_at": {
          "type": "string"
        },
        "settled_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "receipt_url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "paid_with": {
          "anyOf": [
            {
              "$ref": "#/$defs/PaidWithResponse"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    }
  }
}

Illustrative response shape. Values are placeholders, not a recorded result.

json
[
  {
    "id": "<value>",
    "kind": "load",
    "amount_cents": 0,
    "credits": 0,
    "status": "pending",
    "provider_ref": "<value>",
    "error": "<value>",
    "created_at": "<value>",
    "settled_at": "<value>",
    "receipt_url": "<value>",
    "paid_with": {
      "brand": "<value>",
      "last4": "<value>"
    }
  }
]

Returns 200 or 422.

POST /v1/billing/loads

Buy credits

Only an organization admin can use this.

bash
curl -H "x-api-key: $PHI_KEY" -X POST https://api.dynophi.com/v1/billing/loads \
  -H "content-type: application/json" \
  -d '{
  "amount_cents": "<amount_cents>"
}'

Body

NameType
amount_centsoptionalinteger or null
packoptionalstring or null
return_urloptionalstring or null
Complete request schemaShow

Fields

NameType
amount_centsoptionalinteger or null
packoptionalstring or null
return_urloptionalstring or null
JSON schema
{
  "$ref": "#/$defs/LoadRequest",
  "$defs": {
    "LoadRequest": {
      "type": "object",
      "properties": {
        "amount_cents": {
          "anyOf": [
            {
              "type": "integer",
              "exclusiveMinimum": 0
            },
            {
              "type": "null"
            }
          ]
        },
        "pack": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "return_url": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 300
            },
            {
              "type": "null"
            }
          ]
        }
      }
    }
  }
}

201 response (application/json)

201 response fields and schemaShow

Fields

NameType
urlrequiredstring
loadrequiredobject
JSON schema
{
  "$ref": "#/$defs/LoadStartResponse",
  "$defs": {
    "PaidWithResponse": {
      "type": "object",
      "properties": {
        "brand": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "last4": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "LoadResponse": {
      "type": "object",
      "required": [
        "id",
        "kind",
        "amount_cents",
        "credits",
        "status",
        "provider_ref",
        "error",
        "created_at",
        "settled_at"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "kind": {
          "type": "string",
          "enum": [
            "load",
            "auto"
          ]
        },
        "amount_cents": {
          "type": "integer"
        },
        "credits": {
          "type": "integer"
        },
        "status": {
          "type": "string",
          "enum": [
            "pending",
            "charged",
            "credited",
            "failed"
          ]
        },
        "provider_ref": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "created_at": {
          "type": "string"
        },
        "settled_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "receipt_url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "paid_with": {
          "anyOf": [
            {
              "$ref": "#/$defs/PaidWithResponse"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "LoadStartResponse": {
      "type": "object",
      "required": [
        "url",
        "load"
      ],
      "properties": {
        "url": {
          "type": "string"
        },
        "load": {
          "$ref": "#/$defs/LoadResponse"
        }
      }
    }
  }
}

Illustrative response shape. Values are placeholders, not a recorded result.

json
{
  "url": "<value>",
  "load": {
    "id": "<value>",
    "kind": "load",
    "amount_cents": 0,
    "credits": 0,
    "status": "pending",
    "provider_ref": "<value>",
    "error": "<value>",
    "created_at": "<value>",
    "settled_at": "<value>",
    "receipt_url": "<value>",
    "paid_with": {
      "brand": "<value>",
      "last4": "<value>"
    }
  }
}

Returns 201 or 422.

POST /v1/billing/portal

Manage payment methods

Only an organization admin can use this.

bash
curl -H "x-api-key: $PHI_KEY" -X POST https://api.dynophi.com/v1/billing/portal \
  -H "content-type: application/json" \
  -d '{}'

Body

NameType
return_urloptionalstring or null
Complete request schemaShow

Fields

NameType
return_urloptionalstring or null
JSON schema
{
  "anyOf": [
    {
      "$ref": "#/$defs/PortalRequest"
    },
    {
      "type": "null"
    }
  ],
  "$defs": {
    "PortalRequest": {
      "type": "object",
      "properties": {
        "return_url": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 300
            },
            {
              "type": "null"
            }
          ]
        }
      }
    }
  }
}

200 response (application/json)

200 response fields and schemaShow

Fields

NameType
urlrequiredstring
JSON schema
{
  "$ref": "#/$defs/PortalResponse",
  "$defs": {
    "PortalResponse": {
      "type": "object",
      "required": [
        "url"
      ],
      "properties": {
        "url": {
          "type": "string"
        }
      }
    }
  }
}

Illustrative response shape. Values are placeholders, not a recorded result.

json
{
  "url": "<value>"
}

Returns 200 or 422.

PUT /v1/billing/spend-limit

Set the monthly spend limit

Only an organization admin can use this.

bash
curl -H "x-api-key: $PHI_KEY" -X PUT https://api.dynophi.com/v1/billing/spend-limit \
  -H "content-type: application/json" \
  -d '{}'

Body

NameType
monthly_creditsoptionalinteger or null
notify_percentoptionalinteger or null
Complete request schemaShow

Fields

NameType
monthly_creditsoptionalinteger or null
notify_percentoptionalinteger or null
JSON schema
{
  "$ref": "#/$defs/SpendLimitRequest",
  "$defs": {
    "SpendLimitRequest": {
      "type": "object",
      "properties": {
        "monthly_credits": {
          "anyOf": [
            {
              "type": "integer",
              "exclusiveMinimum": 0
            },
            {
              "type": "null"
            }
          ]
        },
        "notify_percent": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            {
              "type": "null"
            }
          ]
        }
      }
    }
  }
}

200 response (application/json)

200 response fields and schemaShow

Fields

NameType
monthly_creditsrequiredinteger or null
notify_percentrequiredinteger or null
used_this_monthrequiredinteger
JSON schema
{
  "$ref": "#/$defs/SpendLimitResponse",
  "$defs": {
    "SpendLimitResponse": {
      "type": "object",
      "required": [
        "monthly_credits",
        "notify_percent",
        "used_this_month"
      ],
      "properties": {
        "monthly_credits": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ]
        },
        "notify_percent": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ]
        },
        "used_this_month": {
          "type": "integer"
        }
      }
    }
  }
}

Illustrative response shape. Values are placeholders, not a recorded result.

json
{
  "monthly_credits": 0,
  "notify_percent": 0,
  "used_this_month": 0
}

Returns 200 or 422.

From phi-api 0.2.2, 2026-11-23.