> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://api.docs.gooclaim.com/llms.txt.
> For full documentation content, see https://api.docs.gooclaim.com/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://api.docs.gooclaim.com/_mcp/server.

# Exchange credentials for a JWT

POST https://api.gooclaim.com/v1/auth/token
Content-Type: application/json

Reference: https://api.docs.gooclaim.com/api-reference/auth-service/tokens/create-token

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Gooclaim Auth Service
  version: 1.0.0
paths:
  /v1/auth/token:
    post:
      operationId: create-token
      summary: Exchange credentials for a JWT
      tags:
        - subpackage_tokens
      responses:
        '200':
          description: Token issued
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenResponse'
        '401':
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Rate limited (60 requests per minute per client_id)
          content:
            application/json:
              schema:
                description: Any type
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TokenRequest'
servers:
  - url: https://api.gooclaim.com
  - url: https://api.dev.gooclaim.com
components:
  schemas:
    TokenRequestGrantType:
      type: string
      enum:
        - client_credentials
      title: TokenRequestGrantType
    TokenRequest:
      type: object
      properties:
        grant_type:
          $ref: '#/components/schemas/TokenRequestGrantType'
        client_id:
          type: string
        client_secret:
          type: string
          format: password
      required:
        - grant_type
        - client_id
        - client_secret
      title: TokenRequest
    TokenResponseTokenType:
      type: string
      enum:
        - Bearer
      title: TokenResponseTokenType
    TokenResponse:
      type: object
      properties:
        access_token:
          type: string
        token_type:
          $ref: '#/components/schemas/TokenResponseTokenType'
        expires_in:
          type: integer
          description: Seconds until expiry
        scope:
          type: string
          description: Space-separated permissions
      title: TokenResponse
    Error:
      type: object
      properties:
        error:
          type: string
        error_description:
          type: string
      title: Error

```

## SDK Code Examples

```python
import requests

url = "https://api.gooclaim.com/v1/auth/token"

payload = {
    "grant_type": "client_credentials",
    "client_id": "gooclaim_app_12345",
    "client_secret": "S3cureP@ssw0rd!"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.gooclaim.com/v1/auth/token';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"grant_type":"client_credentials","client_id":"gooclaim_app_12345","client_secret":"S3cureP@ssw0rd!"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.gooclaim.com/v1/auth/token"

	payload := strings.NewReader("{\n  \"grant_type\": \"client_credentials\",\n  \"client_id\": \"gooclaim_app_12345\",\n  \"client_secret\": \"S3cureP@ssw0rd!\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.gooclaim.com/v1/auth/token")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"grant_type\": \"client_credentials\",\n  \"client_id\": \"gooclaim_app_12345\",\n  \"client_secret\": \"S3cureP@ssw0rd!\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.gooclaim.com/v1/auth/token")
  .header("Content-Type", "application/json")
  .body("{\n  \"grant_type\": \"client_credentials\",\n  \"client_id\": \"gooclaim_app_12345\",\n  \"client_secret\": \"S3cureP@ssw0rd!\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.gooclaim.com/v1/auth/token', [
  'body' => '{
  "grant_type": "client_credentials",
  "client_id": "gooclaim_app_12345",
  "client_secret": "S3cureP@ssw0rd!"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.gooclaim.com/v1/auth/token");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"grant_type\": \"client_credentials\",\n  \"client_id\": \"gooclaim_app_12345\",\n  \"client_secret\": \"S3cureP@ssw0rd!\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "grant_type": "client_credentials",
  "client_id": "gooclaim_app_12345",
  "client_secret": "S3cureP@ssw0rd!"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.gooclaim.com/v1/auth/token")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```