[{"data":1,"prerenderedAt":146},["ShallowReactive",2],{"blog-post-httpie-bearer-token":3,"recent-posts":83},{"id":4,"uid":5,"url":6,"type":7,"href":8,"tags":9,"first_publication_date":10,"last_publication_date":10,"slugs":11,"linked_documents":13,"lang":14,"alternate_languages":15,"data":16},"awME2BIAACsAGIi0","httpie-bearer-token",null,"blog_posts","https:\u002F\u002Fmarks-personal-website.cdn.prismic.io\u002Fapi\u002Fv2\u002Fdocuments\u002Fsearch?ref=aw9OCRMAAC4A1DEN&q=%5B%5B%3Ad+%3D+at%28document.id%2C+%22awME2BIAACsAGIi0%22%29+%5D%5D",[],"2026-11-30T22:45:17+0000",[12],"httpie-how-to-use-a-bearer-token",[],"en-us",[],{"title":17,"date":23,"description":24,"image":29,"content":39},[18],{"type":19,"text":20,"spans":21,"direction":22},"heading1","HTTPie: How to Use a Bearer Token",[],"ltr","2026-11-30",[25],{"type":26,"text":27,"spans":28,"direction":22},"heading2","Learn how to send a bearer token with HTTPie in the terminal",[],{"dimensions":30,"alt":20,"copyright":6,"url":33,"id":34,"edit":35},{"width":31,"height":32},1280,720,"https:\u002F\u002Fimages.prismic.io\u002Fmarks-personal-website\u002Fyx6oS3WxfYsaWygV_httpie-bearer-token.png?auto=format,compress","yx6oS3WxfYsaWygV",{"x":36,"y":36,"zoom":37,"background":38},0,1,"transparent",[40,44,48,51,54,57,61,64,67,70,73,76,80],{"type":41,"text":42,"spans":43,"direction":22},"paragraph","Before we start, make sure you have \u003Ccode>HTTPie\u003C\u002Fcode> installed on your computer and the token for your API ready. If you don't have HTTPie yet, you can install it with Homebrew:",[],{"type":45,"text":46,"spans":47,"direction":22},"preformatted","brew install httpie",[],{"type":41,"text":49,"spans":50,"direction":22},"First, open your terminal. To send a bearer token, run this command:",[],{"type":45,"text":52,"spans":53,"direction":22},"http -A bearer -a YOUR_TOKEN https:\u002F\u002Fexample.com\u002Fme",[],{"type":41,"text":55,"spans":56,"direction":22},"Just replace \u003Ccode>YOUR_TOKEN\u003C\u002Fcode> with your actual token and \u003Ccode>https:\u002F\u002Fexample.com\u002Fme\u003C\u002Fcode> with your API's URL. The \u003Ccode>-A bearer\u003C\u002Fcode> flag sets the auth type, and \u003Ccode>-a\u003C\u002Fcode> is the token itself. HTTPie turns it into an \u003Ccode>Authorization: Bearer YOUR_TOKEN\u003C\u002Fcode> header. Without a token, most APIs answer with \u003Ccode>401 Unauthorized\u003C\u002Fcode>.",[],{"type":58,"text":59,"spans":60,"direction":22},"heading3","Write the Header Yourself",[],{"type":41,"text":62,"spans":63,"direction":22},"Bearer auth has been built into HTTPie since version 3.0. On an older version, set the header by hand. Keep the quotes, because there's a space after \u003Ccode>Bearer\u003C\u002Fcode>:",[],{"type":45,"text":65,"spans":66,"direction":22},"http https:\u002F\u002Fexample.com\u002Fme 'Authorization:Bearer YOUR_TOKEN'",[],{"type":58,"text":68,"spans":69,"direction":22},"Save the Token in a Session",[],{"type":41,"text":71,"spans":72,"direction":22},"To avoid typing the token on every request, add \u003Ccode>--session=my-api\u003C\u002Fcode> the first time:",[],{"type":45,"text":74,"spans":75,"direction":22},"http --session=my-api -A bearer -a YOUR_TOKEN https:\u002F\u002Fexample.com\u002Fme\nhttp --session=my-api https:\u002F\u002Fexample.com\u002Fme",[],{"type":77,"oembed":78},"embed",{"embed_url":79,"type":77},"",{"type":41,"text":81,"spans":82,"direction":22},"Sessions are saved per host, so \u003Ccode>my-api\u003C\u002Fcode> only sends the token to the same host you used it with.",[],{"results":84,"page":37,"results_per_page":144,"results_size":144,"total_results_size":145,"total_pages":37},[85,106,125],{"id":86,"uid":87,"url":6,"type":7,"href":88,"tags":89,"first_publication_date":90,"last_publication_date":90,"slugs":91,"linked_documents":93,"lang":14,"alternate_languages":94,"data":95},"awSq3hIAACgAGxuI","eza-alias-ls","https:\u002F\u002Fmarks-personal-website.cdn.prismic.io\u002Fapi\u002Fv2\u002Fdocuments\u002Fsearch?ref=aw9OCRMAAC4A1DEN&q=%5B%5B%3Ad+%3D+at%28document.id%2C+%22awSq3hIAACgAGxuI%22%29+%5D%5D",[],"2026-12-01T22:45:29+0000",[92],"eza-how-to-alias-ls",[],[],{"image":96,"title":102},{"dimensions":97,"alt":98,"copyright":6,"url":99,"id":100,"edit":101},{"width":31,"height":32},"eza: How to Alias ls to eza","https:\u002F\u002Fimages.prismic.io\u002Fmarks-personal-website\u002FQf3662ULhYvTAcjG_eza-alias-ls.png?auto=format,compress","Qf3662ULhYvTAcjG",{"x":36,"y":36,"zoom":37,"background":38},[103],{"type":19,"text":104,"spans":105,"direction":22},"eza: How to Alias \"ls\"",[],{"id":107,"uid":108,"url":6,"type":7,"href":109,"tags":110,"first_publication_date":90,"last_publication_date":90,"slugs":111,"linked_documents":113,"lang":14,"alternate_languages":114,"data":115},"awSqwxIAACsAGxtS","httpie-use-sessions","https:\u002F\u002Fmarks-personal-website.cdn.prismic.io\u002Fapi\u002Fv2\u002Fdocuments\u002Fsearch?ref=aw9OCRMAAC4A1DEN&q=%5B%5B%3Ad+%3D+at%28document.id%2C+%22awSqwxIAACsAGxtS%22%29+%5D%5D",[],[112],"httpie-how-to-use-sessions",[],[],{"image":116,"title":122},{"dimensions":117,"alt":118,"copyright":6,"url":119,"id":120,"edit":121},{"width":31,"height":32},"HTTPie: How to Use Sessions","https:\u002F\u002Fimages.prismic.io\u002Fmarks-personal-website\u002FIySRJuI1ZCXHcLeW_httpie-use-sessions.png?auto=format,compress","IySRJuI1ZCXHcLeW",{"x":36,"y":36,"zoom":37,"background":38},[123],{"type":19,"text":118,"spans":124,"direction":22},[],{"id":126,"uid":127,"url":6,"type":7,"href":128,"tags":129,"first_publication_date":90,"last_publication_date":90,"slugs":130,"linked_documents":132,"lang":14,"alternate_languages":133,"data":134},"awSqwBIAACkAGxtG","httpie-basic-auth","https:\u002F\u002Fmarks-personal-website.cdn.prismic.io\u002Fapi\u002Fv2\u002Fdocuments\u002Fsearch?ref=aw9OCRMAAC4A1DEN&q=%5B%5B%3Ad+%3D+at%28document.id%2C+%22awSqwBIAACkAGxtG%22%29+%5D%5D",[],[131],"httpie-how-to-use-basic-auth",[],[],{"image":135,"title":141},{"dimensions":136,"alt":137,"copyright":6,"url":138,"id":139,"edit":140},{"width":31,"height":32},"HTTPie: How to Use Basic Auth","https:\u002F\u002Fimages.prismic.io\u002Fmarks-personal-website\u002FoeeGqoCmCzrcpTfb_httpie-basic-auth.png?auto=format,compress","oeeGqoCmCzrcpTfb",{"x":36,"y":36,"zoom":37,"background":38},[142],{"type":19,"text":137,"spans":143,"direction":22},[],3,114,1796165153213]