# KlaviyoAPI::FormsApi
All URIs are relative to *https://a.klaviyo.com*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |
| [**get_form**](FormsApi.md#get_form) | **GET** /api/forms/{id}/ | Get Form |
| [**get_form_for_form_version**](FormsApi.md#get_form_for_form_version) | **GET** /api/form-versions/{id}/form/ | Get Form for Form Version |
| [**get_form_id_for_form_version**](FormsApi.md#get_form_id_for_form_version) | **GET** /api/form-versions/{id}/relationships/form/ | Get Form ID for Form Version |
| [**get_form_version**](FormsApi.md#get_form_version) | **GET** /api/form-versions/{id}/ | Get Form Version |
| [**get_forms**](FormsApi.md#get_forms) | **GET** /api/forms/ | Get Forms |
| [**get_version_ids_for_form**](FormsApi.md#get_version_ids_for_form) | **GET** /api/forms/{id}/relationships/form-versions/ | Get Version IDs for Form |
| [**get_versions_for_form**](FormsApi.md#get_versions_for_form) | **GET** /api/forms/{id}/form-versions/ | Get Versions for Form |
## get_form
> Hash<String, Object> get_form(id, opts)
Get Form
Get the form with the given ID.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `forms:read`
### Examples
```ruby
require 'time'
require 'klaviyo-api-sdk'
# setup authorization
KlaviyoAPI.configure do |config|
# Configure API key authorization: Klaviyo-API-Key
config.api_key['Klaviyo-API-Key'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer'
end
api_instance = KlaviyoAPI::FormsApi.new
id = 'Y6nRLr' # String | The ID of the form
opts = {
fields_form_version: ['form_type'], # Array | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets
fields_form: ['name'], # Array | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets
include: ['form-versions'] # Array | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#relationships
}
begin
# Get Form
result = api_instance.get_form(id, opts)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling FormsApi->get_form: #{e}"
end
```
#### Using the get_form_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> get_form_with_http_info(id, opts)
```ruby
begin
# Get Form
data, status_code, headers = api_instance.get_form_with_http_info(id, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => Hash<String, Object>
rescue KlaviyoAPI::ApiError => e
puts "Error when calling FormsApi->get_form_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **id** | **String** | The ID of the form | |
| **fields_form_version** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets | [optional] |
| **fields_form** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets | [optional] |
| **include** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#relationships | [optional] |
### Return type
**Hash<String, Object>**
### Authorization
[Klaviyo-API-Key](../README.md#Klaviyo-API-Key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
## get_form_for_form_version
> Hash<String, Object> get_form_for_form_version(id, opts)
Get Form for Form Version
Get the form associated with the given form version.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `forms:read`
### Examples
```ruby
require 'time'
require 'klaviyo-api-sdk'
# setup authorization
KlaviyoAPI.configure do |config|
# Configure API key authorization: Klaviyo-API-Key
config.api_key['Klaviyo-API-Key'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer'
end
api_instance = KlaviyoAPI::FormsApi.new
id = 'id_example' # String |
opts = {
fields_form: ['name'] # Array | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets
}
begin
# Get Form for Form Version
result = api_instance.get_form_for_form_version(id, opts)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling FormsApi->get_form_for_form_version: #{e}"
end
```
#### Using the get_form_for_form_version_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> get_form_for_form_version_with_http_info(id, opts)
```ruby
begin
# Get Form for Form Version
data, status_code, headers = api_instance.get_form_for_form_version_with_http_info(id, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => Hash<String, Object>
rescue KlaviyoAPI::ApiError => e
puts "Error when calling FormsApi->get_form_for_form_version_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **id** | **String** | | |
| **fields_form** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets | [optional] |
### Return type
**Hash<String, Object>**
### Authorization
[Klaviyo-API-Key](../README.md#Klaviyo-API-Key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
## get_form_id_for_form_version
> Hash<String, Object> get_form_id_for_form_version(id)
Get Form ID for Form Version
Get the ID of the form associated with the given form version.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `forms:read`
### Examples
```ruby
require 'time'
require 'klaviyo-api-sdk'
# setup authorization
KlaviyoAPI.configure do |config|
# Configure API key authorization: Klaviyo-API-Key
config.api_key['Klaviyo-API-Key'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer'
end
api_instance = KlaviyoAPI::FormsApi.new
id = 'id_example' # String |
begin
# Get Form ID for Form Version
result = api_instance.get_form_id_for_form_version(id)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling FormsApi->get_form_id_for_form_version: #{e}"
end
```
#### Using the get_form_id_for_form_version_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> get_form_id_for_form_version_with_http_info(id)
```ruby
begin
# Get Form ID for Form Version
data, status_code, headers = api_instance.get_form_id_for_form_version_with_http_info(id)
p status_code # => 2xx
p headers # => { ... }
p data # => Hash<String, Object>
rescue KlaviyoAPI::ApiError => e
puts "Error when calling FormsApi->get_form_id_for_form_version_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **id** | **String** | | |
### Return type
**Hash<String, Object>**
### Authorization
[Klaviyo-API-Key](../README.md#Klaviyo-API-Key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
## get_form_version
> Hash<String, Object> get_form_version(id, opts)
Get Form Version
Get the form version with the given ID.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `forms:read`
### Examples
```ruby
require 'time'
require 'klaviyo-api-sdk'
# setup authorization
KlaviyoAPI.configure do |config|
# Configure API key authorization: Klaviyo-API-Key
config.api_key['Klaviyo-API-Key'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer'
end
api_instance = KlaviyoAPI::FormsApi.new
id = '1234567' # String | The ID of the form version
opts = {
fields_form_version: ['form_type'] # Array | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets
}
begin
# Get Form Version
result = api_instance.get_form_version(id, opts)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling FormsApi->get_form_version: #{e}"
end
```
#### Using the get_form_version_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> get_form_version_with_http_info(id, opts)
```ruby
begin
# Get Form Version
data, status_code, headers = api_instance.get_form_version_with_http_info(id, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => Hash<String, Object>
rescue KlaviyoAPI::ApiError => e
puts "Error when calling FormsApi->get_form_version_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **id** | **String** | The ID of the form version | |
| **fields_form_version** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets | [optional] |
### Return type
**Hash<String, Object>**
### Authorization
[Klaviyo-API-Key](../README.md#Klaviyo-API-Key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
## get_forms
> Hash<String, Object> get_forms(opts)
Get Forms
Get all forms in an account.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `forms:read`
### Examples
```ruby
require 'time'
require 'klaviyo-api-sdk'
# setup authorization
KlaviyoAPI.configure do |config|
# Configure API key authorization: Klaviyo-API-Key
config.api_key['Klaviyo-API-Key'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer'
end
api_instance = KlaviyoAPI::FormsApi.new
opts = {
fields_form: ['name'], # Array | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets
filter: 'filter_example', # String | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#filtering
Allowed field(s)/operator(s):
`id`: `any`, `equals`
`name`: `any`, `contains`, `equals`
`ab_test`: `equals`
`updated_at`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than`
`created_at`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than`
`status`: `equals`
page_cursor: 'page_cursor_example', # String | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#pagination
page_size: 56, # Integer | Default: 20. Min: 1. Max: 100.
sort: 'created_at' # String | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sorting
}
begin
# Get Forms
result = api_instance.get_forms(opts)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling FormsApi->get_forms: #{e}"
end
```
#### Using the get_forms_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> get_forms_with_http_info(opts)
```ruby
begin
# Get Forms
data, status_code, headers = api_instance.get_forms_with_http_info(opts)
p status_code # => 2xx
p headers # => { ... }
p data # => Hash<String, Object>
rescue KlaviyoAPI::ApiError => e
puts "Error when calling FormsApi->get_forms_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **fields_form** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets | [optional] |
| **filter** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`id`: `any`, `equals`<br>`name`: `any`, `contains`, `equals`<br>`ab_test`: `equals`<br>`updated_at`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than`<br>`created_at`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than`<br>`status`: `equals` | [optional] |
| **page_cursor** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#pagination | [optional] |
| **page_size** | **Integer** | Default: 20. Min: 1. Max: 100. | [optional][default to 20] |
| **sort** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sorting | [optional] |
### Return type
**Hash<String, Object>**
### Authorization
[Klaviyo-API-Key](../README.md#Klaviyo-API-Key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
## get_version_ids_for_form
> Hash<String, Object> get_version_ids_for_form(id)
Get Version IDs for Form
Get the IDs of the form versions for the given form.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `forms:read`
### Examples
```ruby
require 'time'
require 'klaviyo-api-sdk'
# setup authorization
KlaviyoAPI.configure do |config|
# Configure API key authorization: Klaviyo-API-Key
config.api_key['Klaviyo-API-Key'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer'
end
api_instance = KlaviyoAPI::FormsApi.new
id = 'id_example' # String |
begin
# Get Version IDs for Form
result = api_instance.get_version_ids_for_form(id)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling FormsApi->get_version_ids_for_form: #{e}"
end
```
#### Using the get_version_ids_for_form_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> get_version_ids_for_form_with_http_info(id)
```ruby
begin
# Get Version IDs for Form
data, status_code, headers = api_instance.get_version_ids_for_form_with_http_info(id)
p status_code # => 2xx
p headers # => { ... }
p data # => Hash<String, Object>
rescue KlaviyoAPI::ApiError => e
puts "Error when calling FormsApi->get_version_ids_for_form_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **id** | **String** | | |
### Return type
**Hash<String, Object>**
### Authorization
[Klaviyo-API-Key](../README.md#Klaviyo-API-Key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
## get_versions_for_form
> Hash<String, Object> get_versions_for_form(id, opts)
Get Versions for Form
Get the form versions for the given form.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `forms:read`
### Examples
```ruby
require 'time'
require 'klaviyo-api-sdk'
# setup authorization
KlaviyoAPI.configure do |config|
# Configure API key authorization: Klaviyo-API-Key
config.api_key['Klaviyo-API-Key'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer'
end
api_instance = KlaviyoAPI::FormsApi.new
id = 'id_example' # String |
opts = {
fields_form_version: ['form_type'], # Array | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets
filter: 'filter_example', # String | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#filtering
Allowed field(s)/operator(s):
`form_type`: `any`, `equals`
`status`: `equals`
`updated_at`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than`
`created_at`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than`
page_cursor: 'page_cursor_example', # String | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#pagination
page_size: 56, # Integer | Default: 20. Min: 1. Max: 100.
sort: 'created_at' # String | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sorting
}
begin
# Get Versions for Form
result = api_instance.get_versions_for_form(id, opts)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling FormsApi->get_versions_for_form: #{e}"
end
```
#### Using the get_versions_for_form_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> get_versions_for_form_with_http_info(id, opts)
```ruby
begin
# Get Versions for Form
data, status_code, headers = api_instance.get_versions_for_form_with_http_info(id, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => Hash<String, Object>
rescue KlaviyoAPI::ApiError => e
puts "Error when calling FormsApi->get_versions_for_form_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **id** | **String** | | |
| **fields_form_version** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets | [optional] |
| **filter** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`form_type`: `any`, `equals`<br>`status`: `equals`<br>`updated_at`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than`<br>`created_at`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than` | [optional] |
| **page_cursor** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#pagination | [optional] |
| **page_size** | **Integer** | Default: 20. Min: 1. Max: 100. | [optional][default to 20] |
| **sort** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sorting | [optional] |
### Return type
**Hash<String, Object>**
### Authorization
[Klaviyo-API-Key](../README.md#Klaviyo-API-Key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json