Package: neutrino-api
Getting startedThe general-purpose APIInitializationAuthenticationIn order to setup authentication and initialization of the API client, you need the following information.ParameterDescriptionuser_idYour user IDapi_keyYour API keyAPI client can be initialized as following.# Configuration parameters and credentialsuser_id='user_id'# Your user IDapi_key='api_key'# Your API keyclient=NeutrinoApiClient(user_id,api_key)Class ReferenceList of ControllersImagingTelephonyDataToolsSecurityAndNetworkingGeolocationECommerceWWWImagingGet controller instanceAn instance of theImagingclass can be accessed from the API Client.imaging_controller=client.imagingimage_resizeResize an image and output as either JPEG or PNG. See:https://www.neutrinoapi.com/api/image-resize/defimage_resize(self,image_url,width,height,format='png')ParametersParameterTagsDescriptionimageUrlRequiredThe URL to the source imagewidthRequiredThe width to resize to (in px) while preserving aspect ratioheightRequiredThe height to resize to (in px) while preserving aspect ratioformatOptionalDefaultValueThe output image format, can be either png or jpgExample Usageimage_url='image-url'width=189height=189format='png'result=imaging_controller.image_resize(image_url,width,height,format)qr_codeGenerate a QR code as a PNG image. See:https://www.neutrinoapi.com/api/qr-code/defqr_code(self,content,width=256,height=256,fg_color='#000000',bg_color='#ffffff')ParametersParameterTagsDescriptioncontentRequiredThe content to encode into the QR code (e.g. a URL or a phone number)widthOptionalDefaultValueThe width of the QR code (in px)heightOptionalDefaultValueThe height of the QR code (in px)fgColorOptionalDefaultValueThe QR code foreground colorbgColorOptionalDefaultValueThe QR code background colorExample Usagecontent='content'width=256height=256fg_color='#000000'bg_color='#ffffff'result=imaging_controller.qr_code(content,width,height,fg_color,bg_color)image_watermarkWatermark one image with another image. See:https://www.neutrinoapi.com/api/image-watermark/defimage_watermark(self,image_url,watermark_url,opacity=50,format='png',position='center',width=None,height=None)ParametersParameterTagsDescriptionimageUrlRequiredThe URL to the source imagewatermarkUrlRequiredThe URL to the watermark imageopacityOptionalDefaultValueThe opacity of the watermark (0 to 100)formatOptionalDefaultValueThe output image format, can be either png or jpgpositionOptionalDefaultValueThe position of the watermark image, possible values are: center, top-left, top-center, top-right, bottom-left, bottom-center, bottom-rightwidthOptionalIf set resize the resulting image to this width (in px) while preserving aspect ratioheightOptionalIf set resize the resulting image to this height (in px) while preserving aspect ratioExample Usageimage_url='image-url'watermark_url='watermark-url'opacity=50format='png'position='center'width=189height=189result=imaging_controller.image_watermark(image_url,watermark_url,opacity,format,position,width,height)html_5_renderRender HTML content to PDF, JPG or PNG. See:https://www.neutrinoapi.com/api/html5-render/defhtml_5_render(self,content,format='PDF',page_size='A4',title=None,margin=0,margin_left=0,margin_right=0,margin_top=0,margin_bottom=0,landscape=False,zoom=1,grayscale=False,media_print=False,media_queries=False,forms=False,css=None,image_width=1024,image_height=None,render_delay=0,header_text_left=None,header_text_center=None,header_text_right=None,header_size=9,header_font='Courier',header_font_size=11,header_line=False,footer_text_left=None,footer_text_center=None,footer_text_right=None,footer_size=9,footer_font='Courier',footer_font_size=11,footer_line=False,page_width=None,page_height=None)ParametersParameterTagsDescriptioncontentRequiredThe HTML content. This can be either a URL to load HTML from or an actual HTML content stringformatOptionalDefaultValueWhich format to output, available options are: PDF, PNG, JPGpageSizeOptionalDefaultValueSet the document page size, can be one of: A0 - A9, B0 - B10, Comm10E, DLE or LettertitleOptionalThe document titlemarginOptionalDefaultValueThe document margin (in mm)marginLeftOptionalDefaultValueThe document left margin (in mm)marginRightOptionalDefaultValueThe document right margin (in mm)marginTopOptionalDefaultValueThe document top margin (in mm)marginBottomOptionalDefaultValueThe document bottom margin (in mm)landscapeOptionalDefaultValueSet the document to lanscape orientationzoomOptionalDefaultValueSet the zoom factor when rendering the page (2.0 for double size, 0.5 for half size)grayscaleOptionalDefaultValueRender the final document in grayscalemediaPrintOptionalDefaultValueUse @media print CSS styles to render the documentmediaQueriesOptionalDefaultValueActivate all @media queries before rendering. This can be useful if you wan't to render the mobile version of a responsive websiteformsOptionalDefaultValueGenerate real (fillable) PDF forms from HTML formscssOptionalInject custom CSS into the HTML. e.g. 'body { background-color: red;}'imageWidthOptionalDefaultValueIf rendering to an image format (PNG or JPG) use this image width (in pixels)imageHeightOptionalIf rendering to an image format (PNG or JPG) use this image height (in pixels). The default is automatic which dynamically sets the image height based on the contentrenderDelayOptionalDefaultValueNumber of milliseconds to wait before rendering the page (can be useful for pages with animations etc)headerTextLeftOptionalText to print to the left-hand side header of each page. e.g. 'My header - Page {page_number} of {total_pages}'headerTextCenterOptionalText to print to the center header of each pageheaderTextRightOptionalText to print to the right-hand side header of each pageheaderSizeOptionalDefaultValueThe height of your header (in mm)headerFontOptionalDefaultValueSet the header font. Fonts available: Times, Courier, Helvetica, ArialheaderFontSizeOptionalDefaultValueSet the header font size (in pt)headerLineOptionalDefaultValueDraw a full page width horizontal line under your headerfooterTextLeftOptionalText to print to the left-hand side footer of each page. e.g. 'My footer - Page {page_number} of {total_pages}'footerTextCenterOptionalText to print to the center header of each pagefooterTextRightOptionalText to print to the right-hand side header of each pagefooterSizeOptionalDefaultValueThe height of your footer (in mm)footerFontOptionalDefaultValueSet the footer font. Fonts available: Times, Courier, Helvetica, ArialfooterFontSizeOptionalDefaultValueSet the footer font size (in pt)footerLineOptionalDefaultValueDraw a full page width horizontal line above your footerpageWidthOptionalSet the PDF page width explicitly (in mm)pageHeightOptionalSet the PDF page height explicitly (in mm)Example Usagecontent='content'format='PDF'page_size='A4'title='title'margin=0margin_left=0margin_right=0margin_top=0margin_bottom=0landscape=Falsezoom=1grayscale=Falsemedia_print=Falsemedia_queries=Falseforms=Falsecss='css'image_width=1024image_height=189render_delay=0header_text_left='header-text-left'header_text_center='header-text-center'header_text_right='header-text-right'header_size=9header_font='Courier'header_font_size=11header_line=Falsefooter_text_left='footer-text-left'footer_text_center='footer-text-center'footer_text_right='footer-text-right'footer_size=9footer_font='Courier'footer_font_size=11footer_line=Falsepage_width=189page_height=189result=imaging_controller.html_5_render(content,format,page_size,title,margin,margin_left,margin_right,margin_top,margin_bottom,landscape,zoom,grayscale,media_print,media_queries,forms,css,image_width,image_height,render_delay,header_text_left,header_text_center,header_text_right,header_size,header_font,header_font_size,header_line,footer_text_left,footer_text_center,footer_text_right,footer_size,footer_font,footer_font_size,footer_line,page_width,page_height)Back to List of ControllersTelephonyGet controller instanceAn instance of theTelephonyclass can be accessed from the API Client.telephony_controller=client.telephonyverify_security_codeCheck if a security code from one of the verify APIs is valid. See:https://www.neutrinoapi.com/api/verify-security-code/defverify_security_code(self,security_code)ParametersParameterTagsDescriptionsecurityCodeRequiredThe security code to verifyExample Usagesecurity_code='security-code'result=telephony_controller.verify_security_code(security_code)hlr_lookupConnect to the global mobile cellular network and retrieve the status of a mobile device. See:https://www.neutrinoapi.com/api/hlr-lookup/defhlr_lookup(self,number,country_code=None)ParametersParameterTagsDescriptionnumberRequiredA phone numbercountryCodeOptionalISO 2-letter country code, assume numbers are based in this country. If not set numbers are assumed to be in international format (with or without the leading + sign)Example Usagenumber='number'country_code='country-code'result=telephony_controller.hlr_lookup(number,country_code)phone_playbackMake an automated call to any valid phone number and playback an audio message. See:https://www.neutrinoapi.com/api/phone-playback/defphone_playback(self,number,audio_url)ParametersParameterTagsDescriptionnumberRequiredThe phone number to call. Must be in valid international formataudioUrlRequiredA URL to a valid audio file. Accepted audio formats are:MP3WAVOGGYou can use the following MP3 URL for testing:https://www.neutrinoapi.com/test-files/test1.mp3Example Usagenumber='number'audio_url='audio-url'result=telephony_controller.phone_playback(number,audio_url)sms_verifySend a unique security code to any mobile device via SMS. See:https://www.neutrinoapi.com/api/sms-verify/defsms_verify(self,number,code_length=5,security_code=None,country_code=None,language_code='en')ParametersParameterTagsDescriptionnumberRequiredThe phone number to send a verification code tocodeLengthOptionalDefaultValueThe number of digits to use in the security code (must be between 4 and 12)securityCodeOptionalPass in your own security code. This is useful if you have implemented TOTP or similar 2FA methods. If not set then we will generate a secure random codecountryCodeOptionalISO 2-letter country code, assume numbers are based in this country. If not set numbers are assumed to be in international format (with or without the leading + sign)languageCodeOptionalDefaultValueThe language to send the verification code in, available languages are:de - Germanen - Englishes - Spanishfr - Frenchit - Italianpt - Portugueseru - RussianExample Usagenumber='number'code_length=5security_code=189country_code='country-code'language_code='en'result=telephony_controller.sms_verify(number,code_length,security_code,country_code,language_code)sms_messageSend a free-form message to any mobile device via SMS. See:https://www.neutrinoapi.com/api/sms-message/defsms_message(self,number,message,country_code=None)ParametersParameterTagsDescriptionnumberRequiredThe phone number to send a message tomessageRequiredThe SMS message to send. Messages are truncated to a maximum of 150 characters for ASCII content OR 70 characters for UTF contentcountryCodeOptionalISO 2-letter country code, assume numbers are based in this country. If not set numbers are assumed to be in international format (with or without the leading + sign)Example Usagenumber='number'message='message'country_code='country-code'result=telephony_controller.sms_message(number,message,country_code)phone_verifyMake an automated call to any valid phone number and playback a unique security code. See:https://www.neutrinoapi.com/api/phone-verify/defphone_verify(self,number,code_length=6,security_code=None,playback_delay=800,country_code=None,language_code='en')ParametersParameterTagsDescriptionnumberRequiredThe phone number to send the verification code tocodeLengthOptionalDefaultValueThe number of digits to use in the security code (between 4 and 12)securityCodeOptionalPass in your own security code. This is useful if you have implemented TOTP or similar 2FA methods. If not set then we will generate a secure random codeplaybackDelayOptionalDefaultValueThe delay in milliseconds between the playback of each security codecountryCodeOptionalISO 2-letter country code, assume numbers are based in this country. If not set numbers are assumed to be in international format (with or without the leading + sign)languageCodeOptionalDefaultValueThe language to playback the verification code in, available languages are:de - Germanen - Englishes - Spanishfr - Frenchit - Italianpt - Portugueseru - RussianExample Usagenumber='number'code_length=6security_code=189playback_delay=800country_code='country-code'language_code='en'result=telephony_controller.phone_verify(number,code_length,security_code,playback_delay,country_code,language_code)Back to List of ControllersDataToolsGet controller instanceAn instance of theDataToolsclass can be accessed from the API Client.data_tools_controller=client.data_toolsemail_validateParse, validate and clean an email address. See:https://www.neutrinoapi.com/api/email-validate/defemail_validate(self,email,fix_typos=False)ParametersParameterTagsDescriptionemailRequiredAn email addressfixTyposOptionalDefaultValueAutomatically attempt to fix typos in the addressExample Usageemail='email'fix_typos=Falseresult=data_tools_controller.email_validate(email,fix_typos)user_agent_infoParse, validate and get detailed user-agent information from a user agent string. See:https://www.neutrinoapi.com/api/user-agent-info/defuser_agent_info(self,user_agent)ParametersParameterTagsDescriptionuserAgentRequiredA user agent stringExample Usageuser_agent='user-agent'result=data_tools_controller.user_agent_info(user_agent)bad_word_filterDetect bad words, swear words and profanity in a given text. See:https://www.neutrinoapi.com/api/bad-word-filter/defbad_word_filter(self,content,censor_character=None)ParametersParameterTagsDescriptioncontentRequiredThe content to scan. This can be either a URL to load content from or an actual content stringcensorCharacterOptionalThe character to use to censor out the bad words foundExample Usagecontent='content'censor_character='censor-character'result=data_tools_controller.bad_word_filter(content,censor_character)convertA powerful unit conversion tool. See:https://www.neutrinoapi.com/api/convert/defconvert(self,from_value,from_type,to_type)ParametersParameterTagsDescriptionfromValueRequiredThe value to convert from (e.g. 10.95)fromTypeRequiredThe type of the value to convert from (e.g. USD)toTypeRequiredThe type to convert to (e.g. EUR)Example Usagefrom_value='from-value'from_type='from-type'to_type='to-type'result=data_tools_controller.convert(from_value,from_type,to_type)phone_validateParse, validate and get location information about a phone number. See:https://www.neutrinoapi.com/api/phone-validate/defphone_validate(self,number,country_code=None,ip=None)ParametersParameterTagsDescriptionnumberRequiredA phone number. This can be in international format (E.164) or local format. If passing local format you should use the 'country-code' or 'ip' options as wellcountryCodeOptionalISO 2-letter country code, assume numbers are based in this country. If not set numbers are assumed to be in international format (with or without the leading + sign)ipOptionalPass in a users IP address and we will assume numbers are based in the country of the IP addressExample Usagenumber='number'country_code='country-code'ip='ip'result=data_tools_controller.phone_validate(number,country_code,ip)Back to List of ControllersSecurityAndNetworkingGet controller instanceAn instance of theSecurityAndNetworkingclass can be accessed from the API Client.security_and_networking_controller=client.security_and_networkingip_probeAnalyze and extract provider information for an IP address. See:https://www.neutrinoapi.com/api/ip-probe/defip_probe(self,ip)ParametersParameterTagsDescriptionipRequiredIPv4 or IPv6 addressExample Usageip='ip'result=security_and_networking_controller.ip_probe(ip)email_verifySMTP based email address verification. See:https://www.neutrinoapi.com/api/email-verify/defemail_verify(self,email,fix_typos=False)ParametersParameterTagsDescriptionemailRequiredAn email addressfixTyposOptionalDefaultValueAutomatically attempt to fix typos in the addressExample Usageemail='email'fix_typos=Falseresult=security_and_networking_controller.email_verify(email,fix_typos)ip_blocklistThe IP Blocklist API will detect potentially malicious or dangerous IP addresses. See:https://www.neutrinoapi.com/api/ip-blocklist/defip_blocklist(self,ip)ParametersParameterTagsDescriptionipRequiredAn IPv4 or IPv6 addressExample Usageip='ip'result=security_and_networking_controller.ip_blocklist(ip)host_reputationCheck the reputation of an IP address, domain name, FQDN or URL against a comprehensive list of blacklists and blocklists. See:https://www.neutrinoapi.com/api/host-reputation/defhost_reputation(self,host,list_rating=3)ParametersParameterTagsDescriptionhostRequiredAn IP address, domain name, FQDN or URL. If you supply a domain/URL it will be checked against the URI DNSBL listslistRatingOptionalDefaultValueOnly check lists with this rating or betterExample Usagehost='host'list_rating=3result=security_and_networking_controller.host_reputation(host,list_rating)Back to List of ControllersGeolocationGet controller instanceAn instance of theGeolocationclass can be accessed from the API Client.geolocation_controller=client.geolocationgeocode_reverseConvert a geographic coordinate (latitude and longitude) into a real world address. See:https://www.neutrinoapi.com/api/geocode-reverse/defgeocode_reverse(self,latitude,longitude,language_code='en',zoom='address')ParametersParameterTagsDescriptionlatitudeRequiredThe location latitude in decimal degrees formatlongitudeRequiredThe location longitude in decimal degrees formatlanguageCodeOptionalDefaultValueThe language to display results in, available languages are:de, en, es, fr, it, pt, ruzoomOptionalDefaultValueThe zoom level to respond with:address - the most precise address availablestreet - the street levelcity - the city levelstate - the state levelcountry - the country levelExample Usagelatitude='latitude'longitude='longitude'language_code='en'zoom='address'result=geolocation_controller.geocode_reverse(latitude,longitude,language_code,zoom)ip_infoGet location information about an IP address and do reverse DNS (PTR) lookups. See:https://www.neutrinoapi.com/api/ip-info/defip_info(self,ip,reverse_lookup=False)ParametersParameterTagsDescriptionipRequiredIPv4 or IPv6 addressreverseLookupOptionalDefaultValueDo a reverse DNS (PTR) lookup. This option can add extra delay to the request so only use it if you need itExample Usageip='ip'reverse_lookup=Falseresult=geolocation_controller.ip_info(ip,reverse_lookup)geocode_addressGeocode an address, partial address or just the name of a place. See:https://www.neutrinoapi.com/api/geocode-address/defgeocode_address(self,address,country_code=None,language_code='en',fuzzy_search=False)ParametersParameterTagsDescriptionaddressRequiredThe address, partial address or name of a place to try and locatecountryCodeOptionalThe ISO 2-letter country code to be biased towards (the default is no country bias)languageCodeOptionalDefaultValueThe language to display results in, available languages are:de, en, es, fr, it, pt, rufuzzySearchOptionalDefaultValueIf no matches are found for the given address, start performing a recursive fuzzy search until a geolocation is found. This option is recommended for processing user input or implementing auto-complete. We use a combination of approximate string matching and data cleansing to find possible location matchesExample Usageaddress='address'country_code='country-code'language_code='en'fuzzy_search=Falseresult=geolocation_controller.geocode_address(address,country_code,language_code,fuzzy_search)Back to List of ControllersECommerceGet controller instanceAn instance of theECommerceclass can be accessed from the API Client.e_commerce_controller=client.e_commercebin_lookupPerform a BIN (Bank Identification Number) or IIN (Issuer Identification Number) lookup. See:https://www.neutrinoapi.com/api/bin-lookup/defbin_lookup(self,bin_number,customer_ip=None)ParametersParameterTagsDescriptionbinNumberRequiredThe BIN or IIN number (the first 6 digits of a credit card number)customerIpOptionalPass in the customers IP address and we will return some extra information about themExample Usagebin_number='bin-number'customer_ip='customer-ip'result=e_commerce_controller.bin_lookup(bin_number,customer_ip)Back to List of ControllersWWWGet controller instanceAn instance of theWWWclass can be accessed from the API Client.www_controller=client.wwwurl_infoParse, analyze and retrieve content from the supplied URL. See:https://www.neutrinoapi.com/api/url-info/defurl_info(self,url,fetch_content=False,ignore_certificate_errors=False,timeout=20)ParametersParameterTagsDescriptionurlRequiredThe URL to probefetchContentOptionalDefaultValueIf this URL responds with html, text, json or xml then return the response. This option is useful if you want to perform further processing on the URL content (e.g. with the HTML Extract or HTML Clean APIs)ignoreCertificateErrorsOptionalDefaultValueIgnore any TLS/SSL certificate errors and load the URL anywaytimeoutOptionalDefaultValueTimeout in seconds. Give up if still trying to load the URL after this number of secondsExample Usageurl='url'fetch_content=Falseignore_certificate_errors=Falsetimeout=20result=www_controller.url_info(url,fetch_content,ignore_certificate_errors,timeout)html_cleanClean and sanitize untrusted HTML. See:https://www.neutrinoapi.com/api/html-clean/defhtml_clean(self,content,output_type)ParametersParameterTagsDescriptioncontentRequiredThe HTML content. This can be either a URL to load HTML from or an actual HTML content stringoutputTypeRequiredThe level of sanitization, possible values are:plain-text: reduce the content to plain text only (no HTML tags at all)simple-text: allow only very basic text formatting tags like b, em, i, strong, ubasic-html: allow advanced text formatting and hyper linksbasic-html-with-images: same as basic html but also allows image tagsadvanced-html: same as basic html with images but also allows many more common HTML tags like table, ul, dl, preExample Usagecontent='content'output_type='output-type'result=www_controller.html_clean(content,output_type)browser_botBrowser bot can extract content, interact with keyboard and mouse events, and execute JavaScript on a website. See:https://www.neutrinoapi.com/api/browser-bot/defbrowser_bot(self,url,timeout=30,delay=3,selector=None,mexec=None,user_agent=None,ignore_certificate_errors=False)ParametersParameterTagsDescriptionurlRequiredThe URL to loadtimeoutOptionalDefaultValueTimeout in seconds. Give up if still trying to load the page after this number of secondsdelayOptionalDefaultValueDelay in seconds to wait before capturing any page data, executing selectors or JavaScriptselectorOptionalExtract content from the page DOM using this selector. Commonly known as a CSS selector, you can find a good referenceheremexecOptionalCollectionExecute JavaScript on the page. Each array element should contain a valid JavaScript statement in string form. If a statement returns any kind of value it will be returned in the 'exec-results' response. For your convenience you can also use the following special shortcut functions:sleep(seconds); Just wait/sleep for the specified number of seconds. click('selector'); Click on the first element matching the given selector. focus('selector'); Focus on the first element matching the given selector. keys('characters'); Send the specified keyboard characters. Use click() or focus() first to send keys to a specific element. enter(); Send the Enter key. tab(); Send the Tab key.Example:[ "click('#button-id')", "sleep(1)", "click('.field-class')", "keys('1234')", "enter()" ]userAgentOptionalOverride the browsers default user-agent string with this oneignoreCertificateErrorsOptionalDefaultValueIgnore any TLS/SSL certificate errors and load the page anywayExample Usageurl='url'timeout=30delay=3selector='selector'mexec=['exec']user_agent='user-agent'ignore_certificate_errors=Falseresult=www_controller.browser_bot(url,timeout,delay,selector,mexec,user_agent,ignore_certificate_errors)Back to List of Controllers