Reference
Instance API
The axios instance: request methods, defaults, interceptors and the request pipeline.
axios.create(config) returns an instance with the same request helpers as the
default export, plus a merged defaults object and its own interceptor
registry.
const api = axios.create({ baseURL: "https://api.example.com", timeout: 5000 });Instance methods
| Method | Kind |
|---|---|
getUri(config) | method |
request(config: AxiosRequestConfig<D, P>) | method |
get(url: string, config?: AxiosRequestConfig<D, P>) | method |
delete(url: string, config?: AxiosRequestConfig<D, P>) | method |
head(url: string, config?: AxiosRequestConfig<D, P>) | method |
options(url: string, config?: AxiosRequestConfig<D, P>) | method |
post(url: string, data?: D, config?: AxiosRequestConfig<D, P>) | method |
put(url: string, data?: D, config?: AxiosRequestConfig<D, P>) | method |
patch(url: string, data?: D, config?: AxiosRequestConfig<D, P>) | method |
postForm(url: string, data?: D, config?: AxiosRequestConfig<D, P>) | method |
putForm(url: string, data?: D, config?: AxiosRequestConfig<D, P>) | method |
patchForm(url: string, data?: D, config?: AxiosRequestConfig<D, P>) | method |
query(url: string, data?: D, config?: AxiosRequestConfig<D, P>) | method |
HTTP verbs generated by the core
lib/core/Axios.js builds the verb helpers from the shared method list:
get, delete, head, options, post, put, patch, purge, link, unlink, query
Static surface of the default export
AxiosStatic (from index.d.ts) declares everything reachable on the default
axios object:
| Member | Kind |
|---|---|
Cancel | property |
CancelToken | property |
Axios | property |
AxiosError | property |
HttpStatusCode | property |
VERSION | property |
isCancel | property |
all | property |
spread | property |
isAxiosError | property |
toFormData | property |
formToJSON | property |
getAdapter | property |
CanceledError | property |
AxiosHeaders | property |
mergeConfig | property |
Instance properties
| Property | Type | Description |
|---|---|---|
defaults | AxiosDefaults | The merged defaults for this instance; mutating it changes later requests. |
interceptors | InterceptorManager | Request/response interceptor registries (see interceptors). |
Merge rules
Instance defaults and per-request config are merged with mergeConfig. Keys
defined per request win; headers, params and auth are merged rather than
replaced. See request config for every key.
Source
Parsed from lib/core/Axios.js and the Axios / AxiosStatic interfaces in
index.d.ts at commit e6b79d9cef79.