You are on page 1of 17
comenm civitai/civital me © Cole O tases 22 REST API Reference extn ir ted his page st retiont Introduction ‘This article dscibes how to use the Cvs! RESTAPL We are going to ba describing the HTTP method, pth, and parameters for vary operation The APL will etn the response satus code response headers and respon bod ‘This stlln active development and wil be updated once more endpeins are made avaiable fr the publi ivitai API v1 Creators + GET opi erestors Images GET fait yimoges Models GET /apiyvimedels Mode! + GET api models/medel ‘Model Version + GET /api/madel-versionsémodalversionk ony econ nha REST.AP Retry el Purogues 9) Ouone © securty isis = Poses About the Pret hit Lnk tagraon » ison Partner Program Image Reprdction ol tty Checks 0s Er potters womenm 1 GET /apmodel-ersionsty-hashhash Tags + GET pi tags GET /apivi/creators, Endpoint URL ower Prmates name | pe Descnton bn sumter | Te*0nbRY oes beret geThsan be nant beeen 2008) (erro) ef een age ten 20 ee Hatt, tu le esos Fame gay pamber The page om which sas ing ents cay FRAG Sere ofr ears aename Responses se pe Deerition savas sng Thewsemamestthe ester resco uncer Thesmeunt of odie thisse nk sing Uo ts mode hr Imetacataotaltems sting rmatacaracuten?age | sting mevdstapagesize sing metacatnotalPoges sting mancatanenPage sting ‘The oa number af tems availe The the current page you ae at The the sie of the batch Te total umber of pages The ul to getthenen batch of tems onipeucontccvnha REST. AP Retreats spinel vey Parte ET pow vey Pareto enone Fe arp er anos avery Prete oivtnedetmedel Parone Fe ET oi vase: er anos vesiny-hh-nah Ser rags endpie URL vey Parte lone sw eely womenm REST AM Retr eves Win Name ype Description metacataprevPage sting ‘Tet to get the previous batch of tems Example Thefallowing example shows a request to ge the fst 3 made gs om cur database cart netpes//ctvttatcon/api/v/evestara?2inie3 \ rm scontent Type: apoiteat on? ssan™ \ ‘This woul yield the following response: ‘ vsersts t » ‘ “sTincts sntepe/etvitedcan/api/va/eodele?ucern » ‘ Lents "nts //etvitedcon/api/vi/nodeleucen > » Fhetadetats { noxtPagers “MDsi/felestat.can/apl/vtsereators?inteabpages2™ GET /api/vV/images oni econ vn REST.AP Retry nel e womenm Endpoint URL hetpes//elvttal-con/ap/v3/ sages uery Parameters Name pe Timit ¢orrtonss) umber pest (orrtonat) number rmodtlid umber (corto rmeddversionl umber (ortom (orto a stu corrzonny —_ Beslean [enum (Nene, Sore, nature, oun (hose Reactions, sort corres) oat conmente, Newest) period coorronayy | SUT HHITING, weary month, sack, O59) page (oPrz0NL) number Response Fields Name Type a umber wt sting aah stung ony econ nha REST.AP Retry el Description “The numberof resus tbe resvned per page. This canbe > number between 0 and 200, By default each page wil return 100 results ‘The D of a posttogetimages from The D ofa medal ta getimages from (model gallery) ‘The D of «model version to get mages fom (model gallery ‘tered 0 version) Fier tw images from a specie user Filter to images that contin mature content flags o¢ not (uncefined etn al The order in whch you wish to srt the resus The time frame in which the images wl be sorted “The page rom which to str fetching creators Description ‘The ido the image ‘The ul oftheimage tis source resoluon The blurhaeh of theimage womenm REST Ata eveen in Name Type Description wit mbar ‘The width of teimage height umber The eight oftheimage ef boolean He image has any mature conten bel rafwteve soum (hore, Soft, nature, x) The NSFWlevel of the image crentestt date ‘The date the image was posted pest umber The Daf the post the image belongs to sateen Count rumor “Toe pumber of ry reactions StasloughCount number ‘The pumber of aughreacions statelikeCount umber The number of ike reactions stateheorCount number ‘The numberof heart escons tatecommentCount number ‘The numberof comment resctions mets object ‘Te generation params paseo input for theimage sername sting Tre username of hecteator Ietacataotaltems sting “Te ota numberof toms avaible meacarmautenPage | sting ‘The the current page you are at mevdstapagesize sting The the sie af the bteh IetacataotaPages sting ‘The toa number of pages meacatanerPage sting ‘The uta getthe nat batch efitems metacataprevPage sting Theil to get the previous batch of tems Example ‘The flowing example shows 9 equestto ge te frstimage: content Type! apaiseatian/ sean" \ ony econ nha REST.AP Retry el ow womenm ‘This woul yield the flowing response: > cet pond GET /api/vi/models Endpoint URL hetpss/fetvitelcon/api/viimodels Ch ry Parameters Name Type limit (oertonty umber page (oPrz0%41) umber query corttenaty srring tag (orrzom) sing Username (9eroNaG) ting numil (Cnecepoine, Textual reversion, ‘ypes (orrzouy hypernetuonk, Aertheticorscion, (684, contralnet, Poses) enum (oarest nat sort (orrtonaty ost dounload, period corronas) enum (AIITIne, Year, Roath, Hee, Oay) rating (orto) umber ony econ nha REST.AP Retry el Description ‘The numberof results tobe retumned par page This can be number betweon and 200. By default ach pge wl turn 100 results ‘The page ram which to start fetching models Search query to ter models by name Search query to iter models by 3g Search query to ter models by user The ype of model you want tofiter with none is pedi t wl tur ll types The order in which you wish to sort the results “The timeframe in which the models willbe sores The ating yu wish ofitr the modes with Hroneis specie. ill tun mode with any ating womenm Fier to fvorites ofthe suthenteated user (this equiees an API token o session cook) Fiterthisden models ofthe authentsted er (hs requires an APLIoken oF session ie) Name Type favorites (oPrtoNaL) boolean on) iden ¢oorroNa.) sooteon ‘aur primaryFileonly sootean (eorrosa.) sllowNotredit ostsn (eorrosa.) sllonDeriatver oolan (oori0sa.) allowbiterentienses yan (corto llonCommercalse tone enum (Wome, tnage, Rents Set) ‘Oniyinctse he primary file foreach mode (tis wil se your prefered format options i you use an API token a session cook) Fier t models that requir or don require reiting th ator Fer to models ta low or don'tallow creating derivatives Fert madele tat allow or dn'tllow derivatives to have ferent license Fert madele based on their commercial permissions fale wil return safer images and hide models that don thavesafeimages sf (orrinaty boolean Response Fields Name pe ia umber ame sing scription sing enum (Checkpoint, Textunntaversion, ‘ype hypernetuonk, Aasthetcoractent, Lom, controle, Poses) raf boolean ony econ nha REST.AP Retry el Descrition The denier forthe model The name of the model The desertion ofthe model HTML) The model ype “Whether the model is NSFW oF not womenm Name pe 9 sting mode num (Archived, TakerBoen) [nll crestorucername sing castorimage string | statecownlosdCount uber statfovoriteCount umber statecommentCount umber statratingCount umber statersting umber modiversions id umber modedversions name sing odd Version scription sing odd versions crested ote roddversionsdounlesdel sting moditversions rsinecWords string dddversion filesize umber rmoddVersionsflespicleSeanResult sting ony econ nha REST.AP Retry el Description ‘The tags associated wth the moc The made in which the model is curently of Archive les le willbe empy. Takedown mages flail beens ‘The name ofthe crestor The lof the cestors avatar The uber of dowelonds the made hae The number of fvertes the mode as “The numberof comments he model hos The number af ratings the mods has Te average ating of the model The dentifier for the moda version ‘The name ofthe model version The description of the model version (usualy changelog) The date in which the version was crested The download ult get the medel fle for this specie vesion The words used to rgger te mode Thesize ofthe meds file Status ofthe pile scan (Pending! "Succes Danger’ "Eror) womenm modiversions files vresSeanesult rmodelversion files scanned med Versions files primary odd Versions flesmetatatp modiversions files metainsize rmodelVersion files metaaaformst medddVersionsimages id odd Versionsimagesut! rodidversionsimages.nstw rodiversionsimageswith rmeddlVersionsimages height edd versions images hash rmodedversionsimages mets rmodddversions stats downlesdCount edddversonsststetngCount odd Versions statsating metscatotaltems rmetacatacuren?age metacatanagesize metscatatotlPages pe string Datel nul boolean [undefined ‘enum (p18, #432 lundeined ‘um (4011, prune [Undine enum (saferensor , PickleTensor ovver} [undetined string sting sting umber umber steng objet ul umber umber umber string string sting sting onip econ REST. AP Retry spinel Sots ofthe wr sean (Poncing! ‘Succes, Danger’ Eror ‘The date in which the le was scanned Irth eis he pray fle forthe ‘model version ‘The spect lating point forthe fle The spaced model sire forthe fe ‘The spectied mosel format forthe file The for the image The forte age “whether or not the image ie NSFW (note the model NSFW, West Images on te model s NSFW) The orginal wath ofthe image ‘The riginal height of ne image The blurhseh of theimage The generation params of te mage The number of downland the mode has The number af ratings the moda has The average ating of the model The ola numberof items svitsote The the crrentpage you areat The these of the batch The total number of pages womenm REST Aras even in Name pe Description rmetacatanonPage sting ‘Te ul to get the net batch of items Thewl to gtthe previous bath of rmetacaraprevPage string ae eonmers "Note:The download urlusesa content-dtsposition header ost the lename correctly Be sure to enable that header when fetching the download For example with wast yet netpsi/fetvtat.con/aplydowniensinadels/(rodelVerstonie} ~-content-sispositton Example The folowing example shows a toquestto get tne frst 3 Textuattwerston models fom our database: Ht *content-Type: apaiteation/ssan” \ This woul yield the flowing response: > chet expand GET /api/vi/models/;modelld Endpoint URL Response Fields Name ‘ype Description a uber The enti forthe model name sing ‘Tae name ofthe model escripton sing ‘The dascrioton ofthe model HTML) ony econ nha REST.AP Retry el womenm ‘ype atu 9s mode cestarimage modiversions id medeversions name modded Versions scription mod Versions crestedat rmodedVersionsdounlesde modedversions rainecWords modeVersion files sik moddVersion is peleScanResul moddVersions ies vresScanesult moddversion ies scanned model versions files metasiatp pe enum (Chackooint, TextuaiTaversion, Lom, contalnet, P9962) boolean sing enum (lrehived, ToterDoe) | null string string | umber string steng ome sting sting umber steing sting Datel nul ‘enum (fot6, #22) Lundeined ony econ nha REST.AP Retry el The model ype “whether the model is NSFW oF not The tags associated with the model The made in which the model is currently nf arenivd les eld willbe emp. rakenovn images fits willbe ey The name of the castor Theil of the cestors avatar The dente forthe modal version The name of the mod version The descipton of the model version (usualy changelog) The late inwhich the version was crested The download ut get he mode! fe for this specie version The words use to igger the mode Thesize of the meds fle Stats ofthe pickle scan (Pending! ‘Succes ‘Danger’ "Eror) Status ofthe wr ean (Pending Success Danger "E40r) The dat in which the file was scanned The spectied lating point forte fle womenm rmodelVersions files metastasize ddd Versions files metadata format rmodddversionsimages a odd version images nt rodddVesionsimageswith rmodiversionsimages height edd Versions images hash mod Versionsimages mets pe ‘num (411, grave [Undine enum (SefeTenor ovner} [undefined sng steng ‘umber umber string objet | nl “Te spectied model size forthe fle The specie model forma forthe fle ‘The ul forte image “Whether of not the image is NSFW (note if themed NSFW, teat all images onthe made as NSFW) The orginal with ofthe image ‘The original height of the image The brash oftheimage The generation params ef te image Note:The download urluses 2 content-dtsparition header ost the Slename cotedly Be sure to enable tht hese’ when fetching the download For example with wget Example netpes//ctvitatcon/spt/downione/nocele (rocelVarstone) ‘Thefolloning example shows a requestto get the fret Textestzwersion models fom aur dtabaee: cart netpes//ctvitatcon/ph/va/nodels/2362 \ This woul yield the following response: > Clit epan piieation/ json" \ GET /api/vi/models-versions/:modelVersionld Endpoint URL tony econ REST. AP Retry el comenm Response Fields Name Type i umber ame string escription string model name string medeype Iyoernetwork, AestheticGradent, LORA, Conteoinet, Poses) med boolean model po boolean mod mode enum (Archived, Tekerdeen) | nul model umber crentesst ate downloade sing traneaiords sting) Ailes sien umber filespicleScanResukt sing filevirsSeanResult sing ony econ nha REST.AP Retry el Description ‘Tha identi for the madelvesion “he name ofthe model version ‘The description of the model version usualy 9 changelog) ‘The name ofthe model ‘ha model ye Whether the mode ie NSFW er nat Whether the models a» person of interest or ‘The mode in which the models ctreny on. es el wil be empty "akerden images fl willbe empty ‘The identifies or the model ‘The date in which the version was crests ‘he download ul to gtthe modal fortis specticversion ‘The words used to wigger the model ‘The size of the model le ‘Satu ofthe pickle sean (Pending, "Succss ange "Eror| ‘Satu of the virus san (Pending "Suess ange Eror| womenm REST Attra even ein Name type Description fiesscannedet ato nul ‘The date in which the fle was scanned filezmetasstasp enum (a6, Fe32)Lunsefined ‘The specifies featng paint forth le ‘esmetadtasize enum (el, prune [undefined ‘he specified made size or he le enum (aferensor, PickieTensor, otner Slegmetdstaformst ‘The specified made format forthe le undefined statecownlosdCount number ‘The numberof downoad the model has statratingCount umber ‘Tha number efatings the model has staterating umber “The average rating of the model images string ‘he ve forte image Whether or not the image NSFW note ife Images st string ‘motels NSFW, eat alliage onthe model se NSFW) Imageswisth umber “The cxiginalwisth of heimage Imagesheight umber ‘he eiginal height ofthe image imageshash sring ‘he burs of the image images mets objet | ul ‘The ganeration params of tha image Note:The downloas urlusesa content-disposition header ‘ost the lename corey Be sur to enable that header when fetching the download For example with wast est hetpa://cLvica.con/4pi/owttontnedels/fnodeLVerstonie) --content-éisponstion Example ‘The flowing example shows a request to get model version Irom aur database Content-Type: apaiteation/ssan” \ ony econ nha REST.AP Retry el ww womenm ‘This woul yield the flowing response: > chet expand GET /api/vi/models-ver Endpoint URL ins /by-hash/hash hetps://chvital.con/ap/vifmodel-verstons/bychash/shash Response Fields Somes standard medel-versians endpnt Note: We support the following hash gorithms AutoVT, AutoV2, SHAZS6, CRCB2, and Baked Note 2: We aestil inthe process of hashing alder les, so these results ace complete GET /api/vitags Endpoint URL hetpss//ebvitatcon/apia/tons Query Parameters Name bin (eort0xa) age (oori0ss) exe cortoma.y Response Fields ype umber mbar sting Description The number of results tobe returned per page This can bea rumber between 1 and 200.8) ett each page wil tun 20 result sett 0, return the age “The page from which start fetching tags Search query to fter tags by name ony econ nha REST.AP Retry el womenm RESTA Rtraes even cin Name ype Description name sting Thenameof the tag rmedelCount umber The amount of meddle nkee tothe ag nk sing Udo get all modes fom this ag metscatnotatems sting The lal numba aftems avaible rmatacatacurenage sting Tete current pageyouareat metacntapagesize sting The the sizeof thebatch metscstntctlPages sting The lal number af ges mmetscaranerPage sting The togetthenextatch of items rmetacataprevPage sting Theil to getthe previous batch of tems Example ‘The flloning empl shows 9 request to gp te fst 3 made ags frm our catabase scontent Type: apaiseation/ eon" \ ‘This woul yield the flowing response: Toners "meeps /eteatcan/aph/ea/ne Lareast » ‘ ony econ nha REST.AP Retry el comenm , Thetadata™s { spertrage’: Thttos://ctwitad.con/apiva/t , > ony econ nha REST.AP Retry el

You might also like