---
title: "POST /users/{user_id}/cards"
method: POST
path: "/users/{user_id}/cards"
tags: ["userCards"]
---

# POST /users/{user_id}/cards

`POST /users/{user_id}/cards`

## Request

- Base URL: `https://api.outdoorsy.com/v0`
- URL: `https://api.outdoorsy.com/v0/users/{user_id}/cards`
- Auth: one of:
  - API key in header `Authorization`
  - API key in header `API-Key`
- TypeScript: <https://skmtc.dev/outdoorsy/apis/outdoorsy-api-documentation/docs/users/:user_id/cards/post.ts> (a function with typed inputs; its response is checked against the schema)

Create a credit card and assigns to user

## Path parameters

- `user_id` integer, required

## Request body

- CreateCard
  - `default` boolean
  - `payment_processor` PaymentProcessor: Typically this object is composed into a struct, but embedded into the same table using the `db:",embed"` struct tag.
    - `country` string
    - `external_processor` string
    - `external_processor_id` string
    - `name` string
  - `stripe_token` string

## Response `201`

- UserCard
  - `brand` string
  - `created` string
  - `default` boolean
  - `exp_month` integer
  - `exp_year` integer
  - `id` integer
  - `last_four` string
  - `latest_setup_intent_id` string
  - `owner_id` integer
  - `payment_processor` PaymentProcessor: Typically this object is composed into a struct, but embedded into the same table using the `db:",embed"` struct tag.
    - `country` string
    - `external_processor` string
    - `external_processor_id` string
    - `name` string
  - `stripe_token` string: internal
  - `updated` string

## Other responses

- `401`: Unauthorized error
- `404`: Not found error
- `default`: An unknown, unexpected error.

---

[API](https://skmtc.dev/outdoorsy/apis/outdoorsy-api-documentation.md) - [All operations](https://skmtc.dev/outdoorsy/apis/outdoorsy-api-documentation/llms.txt) - [OpenAPI document](https://skmtc.dev/outdoorsy/apis/outdoorsy-api-documentation/revisions/f0cf8f605ea0?raw)
