[{"data":1,"prerenderedAt":610},["ShallowReactive",2],{"doc-sdks\u002Fgo":3,"content-query-AzpQ8u7kXM":4},null,{"_path":5,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":9,"description":8,"sidebar_position":10,"body":11,"_type":604,"_id":605,"_source":606,"_file":607,"_stem":608,"_extension":609},"\u002Fdocs\u002Fsdks\u002Fgo","sdks",false,"","Go SDK",4,{"type":12,"children":13,"toc":597},"root",[14,22,39,54,61,66,71,104,117,123,136,337,343,348,409,415,580,586,591],{"type":15,"tag":16,"props":17,"children":19},"element","h1",{"id":18},"go-sdk",[20],{"type":21,"value":9},"text",{"type":15,"tag":23,"props":24,"children":29},"div",{"className":25,"ariaHidden":28},[26,27],"docs-page-hero","docs-page-hero--sage","true",[30,32],{"type":21,"value":31},"\n  ",{"type":15,"tag":33,"props":34,"children":38},"img",{"src":35,"alt":8,"width":36,"height":37},"\u002Fimages\u002Fdocs-illustrations\u002Fsdks.svg",128,72,[],{"type":15,"tag":40,"props":41,"children":42},"p",{},[43,45,52],{"type":21,"value":44},"The local Go SDK module is ",{"type":15,"tag":46,"props":47,"children":49},"code",{"className":48},[],[50],{"type":21,"value":51},"github.com\u002Fcredvault\u002Fcredvault-edge-go",{"type":21,"value":53},". It uses Go modules and provides typed resource structs for the main CredVault APIs.",{"type":15,"tag":55,"props":56,"children":58},"h2",{"id":57},"installation",[59],{"type":21,"value":60},"Installation",{"type":15,"tag":40,"props":62,"children":63},{},[64],{"type":21,"value":65},"Use the local source module provided by CredVault, or a private Git repository that contains that module path.",{"type":15,"tag":40,"props":67,"children":68},{},[69],{"type":21,"value":70},"If the module is hosted in your Git provider, install it with:",{"type":15,"tag":72,"props":73,"children":77},"pre",{"className":74,"code":75,"language":76,"meta":8,"style":8},"language-bash shiki shiki-themes github-dark","go get github.com\u002Fcredvault\u002Fcredvault-edge-go\n","bash",[78],{"type":15,"tag":46,"props":79,"children":80},{"__ignoreMap":8},[81],{"type":15,"tag":82,"props":83,"children":86},"span",{"class":84,"line":85},"line",1,[87,93,99],{"type":15,"tag":82,"props":88,"children":90},{"style":89},"--shiki-default:#B392F0",[91],{"type":21,"value":92},"go",{"type":15,"tag":82,"props":94,"children":96},{"style":95},"--shiki-default:#9ECBFF",[97],{"type":21,"value":98}," get",{"type":15,"tag":82,"props":100,"children":101},{"style":95},[102],{"type":21,"value":103}," github.com\u002Fcredvault\u002Fcredvault-edge-go\n",{"type":15,"tag":40,"props":105,"children":106},{},[107,109,115],{"type":21,"value":108},"If your organization keeps the module in a private Git provider, make sure users have access to that repository before they run ",{"type":15,"tag":46,"props":110,"children":112},{"className":111},[],[113],{"type":21,"value":114},"go get",{"type":21,"value":116},".",{"type":15,"tag":55,"props":118,"children":120},{"id":119},"connecting-to-credvault",[121],{"type":21,"value":122},"Connecting to CredVault",{"type":15,"tag":40,"props":124,"children":125},{},[126,128,134],{"type":21,"value":127},"The SDK defaults to ",{"type":15,"tag":46,"props":129,"children":131},{"className":130},[],[132],{"type":21,"value":133},"http:\u002F\u002Flocalhost:5000\u002Fapi",{"type":21,"value":135},", which is only for local backend development. Production code must set the CredVault backend API URL on the client.",{"type":15,"tag":72,"props":137,"children":140},{"className":138,"code":139,"language":92,"meta":8,"style":8},"language-go shiki shiki-themes github-dark","package main\n\nimport (\n    \"fmt\"\n    \"os\"\n\n    credvault \"github.com\u002Fcredvault\u002Fcredvault-edge-go\"\n)\n\nfunc main() {\n    client := credvault.New(os.Getenv(\"CREDVAULT_API_KEY\"))\n    client.Client.BaseURL = \"https:\u002F\u002F\u003Cyour-credvault-backend>\u002Fapi\"\n\n    customers, err := client.Data.Query(\"customers\", map[string]string{\n        \"status\": \"active\",\n    })\n    if err != nil {\n        panic(err)\n    }\n\n    fmt.Println(customers)\n}\n",[141],{"type":15,"tag":46,"props":142,"children":143},{"__ignoreMap":8},[144,152,162,171,179,188,196,205,214,222,231,240,249,257,266,275,284,293,302,311,319,328],{"type":15,"tag":82,"props":145,"children":146},{"class":84,"line":85},[147],{"type":15,"tag":82,"props":148,"children":149},{},[150],{"type":21,"value":151},"package main\n",{"type":15,"tag":82,"props":153,"children":155},{"class":84,"line":154},2,[156],{"type":15,"tag":82,"props":157,"children":159},{"emptyLinePlaceholder":158},true,[160],{"type":21,"value":161},"\n",{"type":15,"tag":82,"props":163,"children":165},{"class":84,"line":164},3,[166],{"type":15,"tag":82,"props":167,"children":168},{},[169],{"type":21,"value":170},"import (\n",{"type":15,"tag":82,"props":172,"children":173},{"class":84,"line":10},[174],{"type":15,"tag":82,"props":175,"children":176},{},[177],{"type":21,"value":178},"    \"fmt\"\n",{"type":15,"tag":82,"props":180,"children":182},{"class":84,"line":181},5,[183],{"type":15,"tag":82,"props":184,"children":185},{},[186],{"type":21,"value":187},"    \"os\"\n",{"type":15,"tag":82,"props":189,"children":191},{"class":84,"line":190},6,[192],{"type":15,"tag":82,"props":193,"children":194},{"emptyLinePlaceholder":158},[195],{"type":21,"value":161},{"type":15,"tag":82,"props":197,"children":199},{"class":84,"line":198},7,[200],{"type":15,"tag":82,"props":201,"children":202},{},[203],{"type":21,"value":204},"    credvault \"github.com\u002Fcredvault\u002Fcredvault-edge-go\"\n",{"type":15,"tag":82,"props":206,"children":208},{"class":84,"line":207},8,[209],{"type":15,"tag":82,"props":210,"children":211},{},[212],{"type":21,"value":213},")\n",{"type":15,"tag":82,"props":215,"children":217},{"class":84,"line":216},9,[218],{"type":15,"tag":82,"props":219,"children":220},{"emptyLinePlaceholder":158},[221],{"type":21,"value":161},{"type":15,"tag":82,"props":223,"children":225},{"class":84,"line":224},10,[226],{"type":15,"tag":82,"props":227,"children":228},{},[229],{"type":21,"value":230},"func main() {\n",{"type":15,"tag":82,"props":232,"children":234},{"class":84,"line":233},11,[235],{"type":15,"tag":82,"props":236,"children":237},{},[238],{"type":21,"value":239},"    client := credvault.New(os.Getenv(\"CREDVAULT_API_KEY\"))\n",{"type":15,"tag":82,"props":241,"children":243},{"class":84,"line":242},12,[244],{"type":15,"tag":82,"props":245,"children":246},{},[247],{"type":21,"value":248},"    client.Client.BaseURL = \"https:\u002F\u002F\u003Cyour-credvault-backend>\u002Fapi\"\n",{"type":15,"tag":82,"props":250,"children":252},{"class":84,"line":251},13,[253],{"type":15,"tag":82,"props":254,"children":255},{"emptyLinePlaceholder":158},[256],{"type":21,"value":161},{"type":15,"tag":82,"props":258,"children":260},{"class":84,"line":259},14,[261],{"type":15,"tag":82,"props":262,"children":263},{},[264],{"type":21,"value":265},"    customers, err := client.Data.Query(\"customers\", map[string]string{\n",{"type":15,"tag":82,"props":267,"children":269},{"class":84,"line":268},15,[270],{"type":15,"tag":82,"props":271,"children":272},{},[273],{"type":21,"value":274},"        \"status\": \"active\",\n",{"type":15,"tag":82,"props":276,"children":278},{"class":84,"line":277},16,[279],{"type":15,"tag":82,"props":280,"children":281},{},[282],{"type":21,"value":283},"    })\n",{"type":15,"tag":82,"props":285,"children":287},{"class":84,"line":286},17,[288],{"type":15,"tag":82,"props":289,"children":290},{},[291],{"type":21,"value":292},"    if err != nil {\n",{"type":15,"tag":82,"props":294,"children":296},{"class":84,"line":295},18,[297],{"type":15,"tag":82,"props":298,"children":299},{},[300],{"type":21,"value":301},"        panic(err)\n",{"type":15,"tag":82,"props":303,"children":305},{"class":84,"line":304},19,[306],{"type":15,"tag":82,"props":307,"children":308},{},[309],{"type":21,"value":310},"    }\n",{"type":15,"tag":82,"props":312,"children":314},{"class":84,"line":313},20,[315],{"type":15,"tag":82,"props":316,"children":317},{"emptyLinePlaceholder":158},[318],{"type":21,"value":161},{"type":15,"tag":82,"props":320,"children":322},{"class":84,"line":321},21,[323],{"type":15,"tag":82,"props":324,"children":325},{},[326],{"type":21,"value":327},"    fmt.Println(customers)\n",{"type":15,"tag":82,"props":329,"children":331},{"class":84,"line":330},22,[332],{"type":15,"tag":82,"props":333,"children":334},{},[335],{"type":21,"value":336},"}\n",{"type":15,"tag":55,"props":338,"children":340},{"id":339},"working-with-data",[341],{"type":21,"value":342},"Working with Data",{"type":15,"tag":40,"props":344,"children":345},{},[346],{"type":21,"value":347},"Go methods return a response and an error. Always check the error before using the response.",{"type":15,"tag":72,"props":349,"children":351},{"className":138,"code":350,"language":92,"meta":8,"style":8},"query := map[string]string{\"status\": \"active\"}\ncustomers, err := client.Data.Query(\"customers\", query)\nif err != nil {\n    panic(err)\n}\n\nfmt.Println(customers)\n",[352],{"type":15,"tag":46,"props":353,"children":354},{"__ignoreMap":8},[355,363,371,379,387,394,401],{"type":15,"tag":82,"props":356,"children":357},{"class":84,"line":85},[358],{"type":15,"tag":82,"props":359,"children":360},{},[361],{"type":21,"value":362},"query := map[string]string{\"status\": \"active\"}\n",{"type":15,"tag":82,"props":364,"children":365},{"class":84,"line":154},[366],{"type":15,"tag":82,"props":367,"children":368},{},[369],{"type":21,"value":370},"customers, err := client.Data.Query(\"customers\", query)\n",{"type":15,"tag":82,"props":372,"children":373},{"class":84,"line":164},[374],{"type":15,"tag":82,"props":375,"children":376},{},[377],{"type":21,"value":378},"if err != nil {\n",{"type":15,"tag":82,"props":380,"children":381},{"class":84,"line":10},[382],{"type":15,"tag":82,"props":383,"children":384},{},[385],{"type":21,"value":386},"    panic(err)\n",{"type":15,"tag":82,"props":388,"children":389},{"class":84,"line":181},[390],{"type":15,"tag":82,"props":391,"children":392},{},[393],{"type":21,"value":336},{"type":15,"tag":82,"props":395,"children":396},{"class":84,"line":190},[397],{"type":15,"tag":82,"props":398,"children":399},{"emptyLinePlaceholder":158},[400],{"type":21,"value":161},{"type":15,"tag":82,"props":402,"children":403},{"class":84,"line":198},[404],{"type":15,"tag":82,"props":405,"children":406},{},[407],{"type":21,"value":408},"fmt.Println(customers)\n",{"type":15,"tag":55,"props":410,"children":412},{"id":411},"available-resources",[413],{"type":21,"value":414},"Available Resources",{"type":15,"tag":416,"props":417,"children":418},"ul",{},[419,431,442,453,464,475,486,497,508,519,530,541,558,569],{"type":15,"tag":420,"props":421,"children":422},"li",{},[423,429],{"type":15,"tag":46,"props":424,"children":426},{"className":425},[],[427],{"type":21,"value":428},"Auth",{"type":21,"value":430}," for sign-in and sign-up",{"type":15,"tag":420,"props":432,"children":433},{},[434,440],{"type":15,"tag":46,"props":435,"children":437},{"className":436},[],[438],{"type":21,"value":439},"Data",{"type":21,"value":441}," for clusters and collection data",{"type":15,"tag":420,"props":443,"children":444},{},[445,451],{"type":15,"tag":46,"props":446,"children":448},{"className":447},[],[449],{"type":21,"value":450},"Cie",{"type":21,"value":452}," for datasets and predictions",{"type":15,"tag":420,"props":454,"children":455},{},[456,462],{"type":15,"tag":46,"props":457,"children":459},{"className":458},[],[460],{"type":21,"value":461},"Webhooks",{"type":21,"value":463}," for event delivery",{"type":15,"tag":420,"props":465,"children":466},{},[467,473],{"type":15,"tag":46,"props":468,"children":470},{"className":469},[],[471],{"type":21,"value":472},"Functions",{"type":21,"value":474}," for serverless functions",{"type":15,"tag":420,"props":476,"children":477},{},[478,484],{"type":15,"tag":46,"props":479,"children":481},{"className":480},[],[482],{"type":21,"value":483},"Triggers",{"type":21,"value":485}," for collection events",{"type":15,"tag":420,"props":487,"children":488},{},[489,495],{"type":15,"tag":46,"props":490,"children":492},{"className":491},[],[493],{"type":21,"value":494},"Backups",{"type":21,"value":496}," for backup and restore",{"type":15,"tag":420,"props":498,"children":499},{},[500,506],{"type":15,"tag":46,"props":501,"children":503},{"className":502},[],[504],{"type":21,"value":505},"Schema",{"type":21,"value":507}," for schema and indexes",{"type":15,"tag":420,"props":509,"children":510},{},[511,517],{"type":15,"tag":46,"props":512,"children":514},{"className":513},[],[515],{"type":21,"value":516},"ApiKeys",{"type":21,"value":518}," for API key management",{"type":15,"tag":420,"props":520,"children":521},{},[522,528],{"type":15,"tag":46,"props":523,"children":525},{"className":524},[],[526],{"type":21,"value":527},"Metrics",{"type":21,"value":529}," for platform monitoring",{"type":15,"tag":420,"props":531,"children":532},{},[533,539],{"type":15,"tag":46,"props":534,"children":536},{"className":535},[],[537],{"type":21,"value":538},"Logs",{"type":21,"value":540}," for activity and audit logs",{"type":15,"tag":420,"props":542,"children":543},{},[544,550,552],{"type":15,"tag":46,"props":545,"children":547},{"className":546},[],[548],{"type":21,"value":549},"Notifications",{"type":21,"value":551}," for notifications; preference methods should be checked against ",{"type":15,"tag":46,"props":553,"children":555},{"className":554},[],[556],{"type":21,"value":557},"\u002Fapi-docs",{"type":15,"tag":420,"props":559,"children":560},{},[561,567],{"type":15,"tag":46,"props":562,"children":564},{"className":563},[],[565],{"type":21,"value":566},"Settings",{"type":21,"value":568}," for account settings, but some methods still need backend route alignment",{"type":15,"tag":420,"props":570,"children":571},{},[572,578],{"type":15,"tag":46,"props":573,"children":575},{"className":574},[],[576],{"type":21,"value":577},"Robots",{"type":21,"value":579}," for robot\u002Fdevice endpoints, but this area still needs route alignment before it is public-ready",{"type":15,"tag":55,"props":581,"children":583},{"id":582},"security",[584],{"type":21,"value":585},"Security",{"type":15,"tag":40,"props":587,"children":588},{},[589],{"type":21,"value":590},"Load credentials from environment variables or a secrets manager. Do not hardcode keys in Go source files, compiled binaries, or example repositories.",{"type":15,"tag":592,"props":593,"children":594},"style",{},[595],{"type":21,"value":596},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":8,"searchDepth":154,"depth":154,"links":598},[599,600,601,602,603],{"id":57,"depth":154,"text":60},{"id":119,"depth":154,"text":122},{"id":339,"depth":154,"text":342},{"id":411,"depth":154,"text":414},{"id":582,"depth":154,"text":585},"markdown","content:docs:sdks:go.md","content","docs\u002Fsdks\u002Fgo.md","docs\u002Fsdks\u002Fgo","md",1794695985570]