Buf(1)
Buf(1) β the manual page, but make it group chat π
Okay bestie, welcome to Buf(1) β no cap, this is the manual for buf-curl. Itβs giving βcURL but for RPC,β and honestly? Iconic.
π NAME π
buf-curl β Invoke an RPC endpoint, a la 'cURL'. Periodt.
π¦ SYNOPSIS π¦
buf curl [flags]
β¨ DESCRIPTION β¨
Okay so this command helps you invoke HTTP RPC endpoints on a server that uses gRPC or Connect. Main character energy fr fr.
By default, server reflection is used, unless the --reflect flag is set to false. Without server reflection, a --schema flag must be provided to indicate the Protobuf schema for the method being invoked. Yes bestie, schema matters. Vibe check your protos.
The only positional argument is the URL of the RPC method to invoke. The name of the method to invoke comes from the last two path components of the URL, which should be the fully-qualified service name and method name, respectively. So like, keep those path bits correct, iykyk.
The URL can use either http or https as the scheme. If http is used then HTTP 1.1 will be used unless the --http2-prior-knowledge flag is set. If https is used then HTTP/2 will be preferred during protocol negotiation and HTTP 1.1 used only if the server does not support HTTP/2. Slay negotiation.
Server reflection, the gRPC protocol, and bidirectional streaming methods all require HTTP/2. So if any of them is used with an http URL, HTTP/2 is used as if the --http2-prior-knowledge flag were set. Not me pointing at the flag like π.
The default RPC protocol used will be Connect. To use a different protocol (gRPC or gRPC-Web), use the --protocol flag. Note that the gRPC protocol cannot be used with HTTP 1.1. Thatβs a hard no, bestie.
The input request is specified via the -d or --data flag. If absent, an empty request is sent. If the flag value starts with an at-sign (@), then the rest of the flag value is interpreted as a filename from which to read the request body. If that filename is just a dash (-), then the request body is read from stdin. The request body is a JSON document that contains the JSON formatted request message. If the RPC method being invoked is a client-streaming method, the request body may consist of multiple JSON values, appended to one another. Multiple JSON documents should usually be separated by whitespace, though this is not strictly required unless the request message type has a custom JSON representation that is not a JSON object. Notes taken, bestie βοΈ.
Request metadata (i.e. headers) are defined using -H or --header flags. The flag value is in "name: value" format. But if it starts with an at-sign (@), the rest of the value is interpreted as a filename from which headers are read, each on a separate line. If the filename is just a dash (-), then the headers are read from stdin.
If headers and the request body are both to be read from the same file (or both read from stdin), the file must include headers first, then a blank line, and then the request body. The way that blank line is doing important work? Obsessed.
π Examples π
- Issue a unary RPC to a plain-text (i.e.
h2c) gRPC server, where the schema for the service is in a Buf module in the current directory, using an empty request message:
$ buf curl --schema . --protocol grpc \
http://localhost:20202/foo.bar.v1.FooService/DoSomething
- Issue an RPC to a Connect server, where the schema comes from the Buf Schema Registry, using a request that is defined as a command-line argument:
$ buf curl --schema buf.build/connectrpc/eliza \
--data '{"name": "Bob Loblaw"}' \
https://demo.connectrpc.com/connectrpc.eliza.v1.ElizaService/Introduce
- Issue a unary RPC to a server that supports reflection, with verbose output:
$ buf curl --data '{"sentence": "I am not feeling well."}' -v \
https://demo.connectrpc.com/connectrpc.eliza.v1.ElizaService/Say
- Issue a client-streaming RPC to a gRPC-web server that supports reflection, where custom headers and request data are both in a heredoc:
$ buf curl --data @- --header @- --protocol grpcweb \
https://demo.connectrpc.com/connectrpc.eliza.v1.ElizaService/Converse \
<<EOM
Custom-Header-1: foo-bar-baz
Authorization: token jas8374hgnkvje9wpkerebncjqol4
{"sentence": "Hi, doc. I feel hungry."}
{"sentence": "What is the answer to life, the universe, and everything?"}
{"sentence": "If you were a fish, what of fish would you be?."}
EOM
Note that server reflection (i.e. use of the --reflect flag) does not work with HTTP 1.1 since the protocol relies on bidirectional streaming. If server reflection is used, the assumed URL for the reflection service is the same as the given URL, but with the last two elements removed and replaced with the service and method name for server reflection. Cute URL surgery, but make it make sense π
.
If an error occurs that is due to incorrect usage or other unexpected error, this program will return an exit code that is less than 8. If the RPC fails otherwise, this program will return an exit code that is the gRPC code, shifted three bits to the left. Exit-code tea, no cap π«Ά.
β¨ OPTIONS β¨
okay bestie, this is the flag buffet β every single one, no skipping, no cap. π
--cacert=""β Path to aPEM-encodedX509certificate pool file that contains the set of trusted certificate authorities/issuers. If omitted, the systemβs default set of trusted certificates are used to verify the serverβs certificate. This option is only valid when the URL uses thehttpsscheme. It is not applicable if--insecureor-kflag is used. Default is"".-E,--cert=""β Path to aPEM-encodedX509certificate file, for using client certificates with TLS. This option is only valid when the URL uses thehttpsscheme. A--keyflag must also be present to provide the private key that corresponds to the given certificate. Default is"".--connect-timeout=0β The time limit, in seconds, for a connection to be established with the server. There is no limit if this flag is not present. Default is0.-d,--data=""β Request data. This should be zero or more JSON documents, each indicating a request message. For unary RPCs, there should be exactly one JSON document. A special value of@means to read the data from the file at (the indicated path). If the path is"-"then the request data is read from stdin. If the same file is indicated as used with the request headers flags (--headeror-H), the file must contain all headers, then a blank line, and then the request body. It is not allowed to indicate stdin if the schema is expected to be provided via stdin as a file descriptor set or image. Default is"".--emit-defaults[=false]β Emit default values for JSON-encoded responses. Default isfalse.-H,--header=[]β Request headers to include with the RPC invocation. This flag may be specified more than once to indicate multiple headers. Each flag value should have the form"name: value". A special value of@means to read headers from the file at (the indicated path). If the path is"-"then headers are read from stdin. If the same file is indicated as used with the request data flag (--dataor-d), the file must contain all headers, then a blank line, and then the request body. It is not allowed to indicate stdin if the schema is expected to be provided via stdin as a file descriptor set or image. Default is[].-h,--help[=false]β help forcurl(yes, literally, thatβs what it says). Default isfalse.--http2-prior-knowledge[=false]β This flag can be used to indicate that HTTP/2 should be used. Without this, HTTP 1.1 will be used with URLs with anhttpscheme, and protocol negotiation will be used to choose either HTTP 1.1 or HTTP/2 for URLs with anhttpsscheme. With this flag set, HTTP/2 is always used, even over plain-text. This flag is implied for URLs with anhttpscheme when server reflection is used, when--protocolis"grpc", or when the method uses bidirectional streaming, since all of these require HTTP/2. Default isfalse.--http3[=false]β This flag can be used to indicate that HTTP/3 should be used. Without this, HTTP 1.1 will be used with URLs with anhttpscheme, and protocol negotiation will be used to choose either HTTP 1.1 or HTTP/2 for URLs with anhttpsscheme. With this flag set, HTTP/3 is always used. Default isfalse.-k,--insecure[=false]β If set, the TLS connection will be insecure and the serverβs certificate will NOT be verified. This is generally discouraged. This option is only valid when the URL uses thehttpsscheme. Default isfalse.--keepalive-time=60β The duration, in seconds, between TCP keepalive transmissions. Default is60.--key=""β Path to aPEM-encodedX509private key file, for using client certificates with TLS. This option is only valid when the URL uses thehttpsscheme. A--certor-Eflag must also be present to provide the certificate and public key that corresponds to the given private key. Default is"".--list-methods[=false]β When set, the command lists supported methods and then exits. If server reflection is used to provide the RPC schema, then the given URL must be a base URL, not including a service or method name. If the schema source is not server reflection, the URL is not used and may be omitted. Default isfalse.--list-services[=false]β When set, the command lists supported services and then exits. If server reflection is used to provide the RPC schema, then the given URL must be a base URL, not including a service or method name. If the schema source is not server reflection, the URL is not used and may be omitted. Default isfalse.-n,--netrc[=false]β If true, a file named.netrcin the userβs home directory will be examined to find credentials for the request. The credentials will be sent via a basic authorization header. The command will fail if the file does not have an entry for the hostname in the URL. This flag is ignored if a--useror-uflag is present. This is ignored if a--headeror-Hflag is provided that sets a header namedAuthorization. Default isfalse.--netrc-file=""β This is just like using--netrcor-n, except that the named file is used instead of a file named.netrcin the userβs home directory. This flag cannot be used with the--netrcor-nflag. This is ignored if a--headeror-Hflag is provided that sets a header namedAuthorization. Default is"".--no-keepalive[=false]β By default, connections are created using TCP keepalive. If this flag is present, they will be disabled. Default isfalse.-o,--output=""β Path to output file to create with response data. If absent, response is printed to stdout. Default is"".--protocol="connect"β The RPC protocol to use. This can be one of"grpc","grpcweb", or"connect". Default is"connect".--reflect[=true]β If true, use server reflection to determine the schema. Default istrue.--reflect-header=[]β Request headers to include with reflection requests. This flag may only be used when--reflectis also set. This flag may be specified more than once to indicate multiple headers. Each flag value should have the form"name: value". But a special value of*may be used to indicate that all normal request headers (from--headerand-Hflags) should also be included with reflection requests. A special value of@means to read headers from the file at (the indicated path). If the path is"-"then headers are read from stdin. It is not allowed to indicate a file with the same path as used with the request data flag (--dataor-d). Furthermore, it is not allowed to indicate stdin if the schema is expected to be provided via stdin as a file descriptor set or image. Default is[].--reflect-protocol=""β The reflection protocol to use for downloading information from the server. This flag may only be used when server reflection is used. By default, this command will try all known reflection protocols from newest to oldest. If this results in a"Not Implemented"error, then older protocols will be used. In practice, this means that"grpc-v1"is tried first, and"grpc-v1alpha"is used if it doesnβt work. If newer reflection protocols are introduced, they may be preferred in the absence of this flag being explicitly set to a specific protocol. The valid values for this flag are"grpc-v1"and"grpc-v1alpha". These correspond to services named"grpc.reflection.v1.ServerReflection"and"grpc.reflection.v1alpha.ServerReflection"respectively. Default is"".--schema=[]β The module to use for the RPC schema. This is necessary if the server does not support server reflection. The format of this argument is the same as for the arguments to otherbufsub-commands such asbuildandgenerate. It can indicate a directory, a file, a remote module in the Buf Schema Registry, or even standard in ("-") for feeding an image or file descriptor set to the command in a shell pipeline. If multiple schema flags are present, they will be consulted in order to resolve service and type names. Setting this flags implies--reflect=falseunless a reflect flag is explicitly present. If both schema and reflect flags are in use, reflection will be used first and the schemas will be consulted in order thereafter if reflection fails to resolve a schema element. Default is[].--servername=""β The server name to use in TLS handshakes (for SNI) if the URL scheme ishttps. If not specified, the default is the origin host in the URL or the value in a"Host"header if one is provided. Default is"".--unix-socket=""β The path to a unix socket that will be used instead of opening a TCP socket to the host and port indicated in the URL. Default is"".-u,--user=""β The user credentials to send, via a basic authorization header. The value should be in the format"username:password". If the value has no colon, it is assumed to just be the username, in which case you will be prompted to enter a password. This overrides the use of a.netrcfile. This is ignored if a--headeror-Hflag is provided that sets a header namedAuthorization. Default is"".-A,--user-agent=""β The user agent string to send. This is ignored if a--headeror-Hflag is provided that sets a header namedUser-Agent. Default is"".-v,--verbose[=false]β Turn on verbose mode. Default isfalse.
π OPTIONS INHERITED FROM PARENT COMMANDS π
these came from the parent command, bestie β still important, still iconic. π«Ά
--debug[=false]β Turn on debug logging (envBUF_DEBUG). Default isfalse.--log-format="color"β The log formattext,color,json(envBUF_LOG_FORMAT). Default is"color".--timeout=0sβ The duration until timing out, setting it to0means no timeout (envBUF_TIMEOUT). Default is0s.
π SEE ALSO π
π HISTORY π
2026-10-22 Auto generated by spf13/cobra
π Thatβs the page, bestie β source/version Auto generated by spf13/cobra, dated 2026-10-22, for Buf(1). Slay. Periodt. π
π¦ where this page comes from
- arch rolling: buf 1.75.0-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms