1 /**
2 * @oas [post] /admin/tax-rates
3 * operationId: PostTaxRates
4 * summary: Create Tax Rate
5 * description: Create a tax rate.
6 * x-authenticated: true
7 * parameters:
8 * - name: fields
9 * in: query
10 * description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default
11 * fields. without prefix it will replace the entire default fields.
12 * required: false
13 * schema:
14 * type: string
15 * title: fields
16 * description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default
17 * fields. without prefix it will replace the entire default fields.
18 * externalDocs:
19 * url: "#select-fields-and-relations"
20 * security:
21 * - api_token: []
22 * - cookie_auth: []
23 * - jwt_token: []
24 * requestBody:
25 * content:
26 * application/json:
27 * schema:
28 * $ref: "#/components/schemas/AdminCreateTaxRate"
29 * x-codeSamples:
30 * - lang: JavaScript
31 * label: JS SDK
32 * source: |-
33 * import Medusa from "@medusajs/js-sdk"
34 *
35 * export const sdk = new Medusa({
36 * baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
37 * debug: import.meta.env.DEV,
38 * auth: {
39 * type: "session",
40 * },
41 * })
42 *
43 * sdk.admin.taxRate.create({
44 * name: "VAT",
45 * tax_region_id: "txreg_123",
46 * code: "VAT",
47 * rate: 2, // 2%
48 * })
49 * .then(({ tax_rate }) => {
50 * console.log(tax_rate)
51 * })
52 * - lang: Shell
53 * label: cURL
54 * source: |-
55 * curl -X POST '{backend_url}/admin/tax-rates' \
56 * -H 'Authorization: Bearer {jwt_token}' \
57 * -H 'Content-Type: application/json' \
58 * --data-raw '{
59 * "name": "Kaylin",
60 * "tax_region_id": "{value}",
61 * "metadata": {}
62 * }'
63 * tags:
64 * - Tax Rates
65 * responses:
66 * "200":
67 * description: OK
68 * content:
69 * application/json:
70 * schema:
71 * $ref: "#/components/schemas/AdminTaxRateResponse"
72 * "400":
73 * $ref: "#/components/responses/400_error"
74 * "401":
75 * $ref: "#/components/responses/unauthorized"
76 * "404":
77 * $ref: "#/components/responses/not_found_error"
78 * "409":
79 * $ref: "#/components/responses/invalid_state_error"
80 * "422":
81 * $ref: "#/components/responses/invalid_request_error"
82 * "500":
83 * $ref: "#/components/responses/500_error"
84 * x-workflow: createTaxRatesWorkflow
85 * x-events: []
86 *
87 */
88