import os
from dataframer import Dataframer
client = Dataframer(
api_key=os.environ.get("DATAFRAMER_API_KEY"), # This is the default and can be omitted
)
spec = client.dataframer.specs.update(
spec_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
content_yaml="spec:\n description: \"Customer support conversations with varying sentiment and priority\"\n requirements: \"Each conversation should include a customer greeting, issue description, and agent response. Maintain professional tone throughout.\"\n data_property_variations:\n - property_name: sentiment\n property_values:\n - positive\n - negative\n - neutral\n base_distributions:\n positive: 40\n negative: 30\n neutral: 30\n - property_name: priority\n property_values:\n - high\n - medium\n - low\n base_distributions:\n high: 20\n medium: 50\n low: 30\n",
)
print(spec.id)curl https://df-api.dataframer.ai/api/dataframer/specs/$SPEC_ID/ \
-X PUT \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $DATAFRAMER_API_KEY" \
-d '{
"content_yaml": "spec:\\n description: \\"Customer support conversations with varying sentiment and priority\\"\\n requirements: \\"Each conversation should include a customer greeting, issue description, and agent response. Maintain professional tone throughout.\\"\\n data_property_variations:\\n - property_name: sentiment\\n property_values:\\n - positive\\n - negative\\n - neutral\\n base_distributions:\\n positive: 40\\n negative: 30\\n neutral: 30\\n - property_name: priority\\n property_values:\\n - high\\n - medium\\n - low\\n base_distributions:\\n high: 20\\n medium: 50\\n low: 30\\n"
}'{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Customer Support Conversations Spec",
"description": "Updated customer support conversations",
"status": "SUCCEEDED",
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T14:30:00Z",
"dataset_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"dataset_name": "Customer Support Dataset",
"dataset_type": "SINGLE_FILE",
"created_by_email": "sarah.chen@acme.com",
"runtime_params": {
"spec_generation_model_name": "anthropic/claude-sonnet-5-thinking",
"generate_distributions": true,
"extrapolate_values": true,
"extrapolate_axes": false
},
"content_yaml": "spec:\n description: \"Updated customer support conversations\"\n data_property_variations:\n - property_name: sentiment\n property_values: [positive, negative, neutral, mixed]\n base_distributions:\n positive: 35\n negative: 25\n neutral: 25\n mixed: 15\n"
}{
"error": "<string>",
"code": "not_supported_hybrid"
}Update spec
Replace a spec with a new version specified using YAML
import os
from dataframer import Dataframer
client = Dataframer(
api_key=os.environ.get("DATAFRAMER_API_KEY"), # This is the default and can be omitted
)
spec = client.dataframer.specs.update(
spec_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
content_yaml="spec:\n description: \"Customer support conversations with varying sentiment and priority\"\n requirements: \"Each conversation should include a customer greeting, issue description, and agent response. Maintain professional tone throughout.\"\n data_property_variations:\n - property_name: sentiment\n property_values:\n - positive\n - negative\n - neutral\n base_distributions:\n positive: 40\n negative: 30\n neutral: 30\n - property_name: priority\n property_values:\n - high\n - medium\n - low\n base_distributions:\n high: 20\n medium: 50\n low: 30\n",
)
print(spec.id)curl https://df-api.dataframer.ai/api/dataframer/specs/$SPEC_ID/ \
-X PUT \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $DATAFRAMER_API_KEY" \
-d '{
"content_yaml": "spec:\\n description: \\"Customer support conversations with varying sentiment and priority\\"\\n requirements: \\"Each conversation should include a customer greeting, issue description, and agent response. Maintain professional tone throughout.\\"\\n data_property_variations:\\n - property_name: sentiment\\n property_values:\\n - positive\\n - negative\\n - neutral\\n base_distributions:\\n positive: 40\\n negative: 30\\n neutral: 30\\n - property_name: priority\\n property_values:\\n - high\\n - medium\\n - low\\n base_distributions:\\n high: 20\\n medium: 50\\n low: 30\\n"
}'{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Customer Support Conversations Spec",
"description": "Updated customer support conversations",
"status": "SUCCEEDED",
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T14:30:00Z",
"dataset_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"dataset_name": "Customer Support Dataset",
"dataset_type": "SINGLE_FILE",
"created_by_email": "sarah.chen@acme.com",
"runtime_params": {
"spec_generation_model_name": "anthropic/claude-sonnet-5-thinking",
"generate_distributions": true,
"extrapolate_values": true,
"extrapolate_axes": false
},
"content_yaml": "spec:\n description: \"Updated customer support conversations\"\n data_property_variations:\n - property_name: sentiment\n property_values: [positive, negative, neutral, mixed]\n base_distributions:\n positive: 35\n negative: 25\n neutral: 25\n mixed: 15\n"
}{
"error": "<string>",
"code": "not_supported_hybrid"
}include_versions=true on the GET endpoint.spec: section of the YAML is editable - the metadata: section is read-only and ignored if included.Authorizations
Body
Complete YAML spec configuration replacing its previous version in the spec. The YAML should have a 'spec' root key containing one or more editable fields: description, requirements, data_property_variations, selected_sql_schema_column, selected_sql_query_columns. To check the expected spec YAML format, check the YAML section in spec view in the UI, or look at YAML returned by the Get spec API endpoint. If a 'metadata' section is present, it is ignored (read-only).
Response
New spec version created and returned
Set when content_yaml is null because the YAML is stored in your own cloud. The spec is ready. A current Python SDK reads the YAML from your data plane and returns it in content_yaml, so it does not set this; the DataFramer app shows it too. Absent otherwise
spec_content_in_data_plane 
