Skip to content

API Reference

The main entry point. Import and instantiate once; reuse the client across your application.

from magicfeedback_sdk import MagicFeedback
client = MagicFeedback(
user="you@example.com",
password="your-password",
base_url="https://api.magicfeedback.io", # optional
)
ParameterTypeDefaultDescription
userstringAccount email address
passwordstringAccount password
base_urlstring"https://api.magicfeedback.io"API root URL
PropertyTypeDescription
feedbacksFeedbackAPIFeedback submission operations
contactsContactsAPICRM contact operations
campaignsCampaignsAPICampaign and session operations
productsProductsAPIProduct listing
metricsMetricsAPIMetrics retrieval
integrations_questionsIntegrationsQuestionsAPIQuestions for an integration
reportsReportsAPIReporting endpoints

Configure the SDK’s internal logger.

import logging
client.set_logging(logging.DEBUG)

Access via client.feedbacks.

ParameterTypeDescription
feedbackdictFeedback payload (see Managing Feedback)

Returns the created feedback object.

ParameterTypeDescription
filterdict | NoneLoopBack filter (see Querying)

Returns a list of feedback objects.

ParameterTypeDescription
feedback_idstringID of the feedback to retrieve
filterdict | NoneOptional field/include filter

Returns a single feedback object.

ParameterTypeDescription
feedback_idstringID of the feedback to update
feedbackdictFields to change

Returns the updated feedback object.

ParameterTypeDescription
feedback_idstringID of the feedback to delete

Returns the deleted feedback object.

upload_attachment(feedback_id, file_path, filename=None, extra_data=None)

Section titled “upload_attachment(feedback_id, file_path, filename=None, extra_data=None)”
ParameterTypeDescription
feedback_idstringID of the feedback to attach the file to
file_pathstringPath to the file on disk
filenamestring | NoneDisplay name — defaults to the file’s base name
extra_datadict | NoneAny JSON-serialisable dict stored with the attachment

Uploads the file as a multipart request. Returns the created attachment object.


Access via client.contacts.

ParameterTypeDescription
contactdictContact payload (see Contacts)

Returns the created contact object.

Returns a list of contact objects.

ParameterTypeDescription
contact_idstringID of the contact to update
contactdictFields to change

Returns the updated contact object.

ParameterTypeDescription
contact_idstringID of the contact to delete

Returns the deleted contact object.


Access via client.campaigns.

ParameterTypeDescription
campaigndictCampaign payload (see Campaigns)

Returns the created campaign object.

Returns a list of campaign objects.

ParameterTypeDescription
campaign_idstringID of the campaign to add a session to
sessiondictSession payload — must include crmContactId (string[])

Returns the created session object.

ParameterTypeDescription
campaign_idstringID of the campaign
filterdict | NoneOptional LoopBack filter

Returns a list of session objects.

get_sessions_feedbacks(campaign_id, filter=None)

Section titled “get_sessions_feedbacks(campaign_id, filter=None)”
ParameterTypeDescription
campaign_idstringID of the campaign
filterdict | NoneOptional LoopBack filter

Returns a list of feedback objects linked to this campaign’s sessions.


Access via client.products.

Returns a list of product objects registered under your account.


Access via client.metrics.

Returns a list of metric objects.


Access via client.integrations_questions.

ParameterTypeDescription
integration_idstringUUID of the integration
filterdict | NoneOptional LoopBack filter

Returns the list of questions configured for the given integration. Use this to look up valid answer keys before creating feedback.

questions = client.integrations_questions.get("0eb9d270-6dd7-11ef-9987-21e04f383573")
for q in questions:
print(q["key"], q["type"])

Access via client.reports.

Returns general report data.

Returns newsletter-specific report data.

ParameterTypeDescription
report_idstringID of the report to update
reportdictFields to change

Returns the updated report object.


All HTTP errors raise requests.exceptions.HTTPError. Wrap calls in a try/except when you need to handle specific status codes:

import requests
try:
feedback = client.feedbacks.create({…})
except requests.exceptions.HTTPError as e:
print(e.response.status_code, e.response.text)

Client-side validation (missing required fields) raises ValueError before the request is sent.