---
updatedAt: 2025-08-11T18:18:17.000Z
agentTools:
  projectIndex: https://docs.keycafe.com/llms.txt
---

# Add Key

Add a key to a bin with a PUT request to the endpoint with the bin ID.

The body should contain the serial number of the Keycafe fob as a JSON object:

```json json
{
  
    “key”: {
        "serialNumber": "012ABC"
    }
}
```

# OpenAPI definition

```json
{
  "openapi": "3.0.3",
  "info": {
    "title": "Keycafe API",
    "version": "0"
  },
  "x-explorer-enabled": true,
  "x-proxy-enabled": true,
  "x-samples-languages": [
    "shell",
    "python",
    "go"
  ],
  "servers": [
    {
      "url": "https://www.keycafe.com/"
    }
  ],
  "components": {
    "securitySchemes": {
      "BasicAuth": {
        "type": "http",
        "scheme": "basic"
      }
    }
  },
  "security": [
    {
      "BasicAuth": []
    }
  ],
  "paths": {
    "/v0/bin/{bin_id}": {
      "put": {
        "tags": [
          "Bin"
        ],
        "summary": "Add Key",
        "description": "Add a key to a bin with a PUT request to the endpoint with the bin ID.",
        "operationId": "add-key",
        "parameters": [
          {
            "name": "bin_id",
            "in": "path",
            "required": true,
            "description": "The unique identifier of bin. </br> Example: 123456",
            "schema": {
              "type": "integer",
              "format": "int64",
              "default": ""
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "properties": {
                      "serialNumber": {
                        "type": "string",
                        "description": "The serial number of the Keycafe fob. </br> Example: 012ABC"
                      }
                    },
                    "required": [
                      "serialNumber"
                    ],
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Key successfully added to the bin.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer",
                      "description": "Unique identifier for the bin.",
                      "example": 123456
                    },
                    "binNumber": {
                      "type": "integer",
                      "description": "Physical number of the bin in the SmartBox.",
                      "example": 1
                    },
                    "fobs": {
                      "type": "boolean",
                      "description": "Indicates whether the bin contains any fobs.",
                      "example": false
                    },
                    "status": {
                      "type": "string",
                      "description": "Current status of the bin (e.g., AVAILABLE, OCCUPIED).",
                      "example": "AVAILABLE"
                    },
                    "box": {
                      "type": "object",
                      "description": "SmartBox device that contains this bin.",
                      "properties": {
                        "id": {
                          "type": "integer",
                          "description": "Unique identifier of the SmartBox.",
                          "example": 123456
                        },
                        "bins": {
                          "type": "integer",
                          "description": "Total number of bins in the SmartBox.",
                          "example": 23
                        },
                        "lastStatusUpdate": {
                          "type": "string",
                          "format": "date-time",
                          "description": "Timestamp of the last status update from the SmartBox.",
                          "example": "2019-07-02T20:47:33Z"
                        },
                        "serialNumber": {
                          "type": "string",
                          "description": "Serial number of the SmartBox.",
                          "example": "123456"
                        },
                        "model": {
                          "type": "string",
                          "description": "Model of the SmartBox device.",
                          "example": "MS100"
                        }
                      }
                    },
                    "key": {
                      "type": "object",
                      "description": "Key currently stored in the bin.",
                      "properties": {
                        "id": {
                          "type": "integer",
                          "description": "Unique identifier of the key.",
                          "example": 123456
                        },
                        "name": {
                          "type": "string",
                          "description": "Display name of the key.",
                          "example": "Bob's Home Key"
                        }
                      }
                    }
                  }
                },
                "examples": {
                  "Result": {
                    "value": "{\n    \"id\": 123456,\n    \"binNumber\": 1,\n    \"fobs\": false,\n    \"status\": \"AVAILABLE\",\n    \"box\": {\n        \"id\": 123456,\n        \"bins\": 23,\n        \"lastStatusUpdate\": \"2019-07-02T20:47:33Z\",\n        \"serialNumber\": \"123456\",\n        \"model\": \"MS100\"\n    },\n    \"key\": {\n        \"id\": 123456,\n        \"name\": \"Bob's Home Key\"\n    }            \n}"
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true
}
```