# Issue a venue-pinned access token (client-credentials)

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "NX Public API",
    "version": "1.0.0",
    "description": "Public marketplace API. Authenticate via POST /oauth/token (client-credentials + venueId) to obtain a short-lived bearer token, then call resource endpoints. Tokens are venue-pinned: each is scoped to a single venue and the scopes granted to that integration."
  },
  "servers": [
    {
      "url": "https://prod.api.nxapp.net/public/v1"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Bearer token from /oauth/token."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "description": "Stable, machine-readable error code (e.g. RESOURCE_NOT_FOUND)."
              },
              "message": {
                "type": "string"
              },
              "details": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              },
              "requestId": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message",
              "requestId"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "TokenResponse": {
        "type": "object",
        "properties": {
          "access_token": {
            "type": "string"
          },
          "token_type": {
            "type": "string",
            "enum": [
              "Bearer"
            ]
          },
          "expires_in": {
            "type": "number"
          },
          "scope": {
            "type": "string"
          }
        },
        "required": [
          "access_token",
          "token_type",
          "expires_in"
        ]
      }
    }
  },
  "paths": {
    "/oauth/token": {
      "post": {
        "summary": "Issue a venue-pinned access token (client-credentials)",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "grant_type": {
                    "type": "string",
                    "enum": [
                      "client_credentials"
                    ]
                  },
                  "client_id": {
                    "type": "string"
                  },
                  "client_secret": {
                    "type": "string"
                  },
                  "venueId": {
                    "type": "string",
                    "description": "Target venue. Must have an active grant for this client."
                  }
                },
                "required": [
                  "grant_type",
                  "client_id",
                  "client_secret",
                  "venueId"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "_id": {
    "buffer": {
      "0": 106,
      "1": 150,
      "2": 23,
      "3": 41,
      "4": 164,
      "5": 38,
      "6": 175,
      "7": 92,
      "8": 201,
      "9": 202,
      "10": 43,
      "11": 17
    }
  }
}
```