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

# Create a storage credential

POST /api/storage/credentials
Content-Type: application/json

Stores a BYO storage credential (Google service account or Azure app). The secret is stored but never returned; the response is redacted. Validates the secret shape per kind (422 on bad shape). Requires `organization:manage`.

Reference: https://docs.cloudraker.com/api/raker-one-api/storage/post-storage-credentials

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: RakerOne API
  version: 1.0.0
paths:
  /storage/credentials:
    post:
      operationId: post-storage-credentials
      summary: Create a storage credential
      description: >-
        Stores a BYO storage credential (Google service account or Azure app).
        The secret is stored but never returned; the response is redacted.
        Validates the secret shape per kind (422 on bad shape). Requires
        `organization:manage`.
      tags:
        - subpackage_storage
      parameters:
        - name: Authorization
          in: header
          description: >-
            WorkOS session JWT or an organization API key, sent as
            `Authorization: Bearer <token>`.
          required: true
          schema:
            type: string
      responses:
        '201':
          description: The created credential (secret redacted).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StorageCredentialResponse'
        '400':
          description: Bad request — the body or parameters failed validation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized — missing or invalid bearer token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden — the caller lacks the required permission.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: The credential secret failed shape validation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                kind:
                  $ref: >-
                    #/components/schemas/StorageCredentialsPostRequestBodyContentApplicationJsonSchemaKind
                label:
                  type: string
                credential:
                  description: Any type
              required:
                - kind
                - label
                - credential
servers:
  - url: /api
    description: Current origin
  - url: https://app.raker.one/api
    description: Production
components:
  schemas:
    StorageCredentialsPostRequestBodyContentApplicationJsonSchemaKind:
      type: string
      enum:
        - google-service-account
        - azure-app
      title: StorageCredentialsPostRequestBodyContentApplicationJsonSchemaKind
    StorageCredentialKind:
      type: string
      enum:
        - google-service-account
        - azure-app
      title: StorageCredentialKind
    StorageCredential:
      type: object
      properties:
        _id:
          type: string
        kind:
          $ref: '#/components/schemas/StorageCredentialKind'
        label:
          type: string
        createdAt:
          type: string
        createdBy:
          type: string
      required:
        - _id
        - kind
        - label
        - createdAt
        - createdBy
      title: StorageCredential
    StorageCredentialResponse:
      type: object
      properties:
        credential:
          $ref: '#/components/schemas/StorageCredential'
      required:
        - credential
      title: StorageCredentialResponse
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Machine-readable error code (e.g. `invalid_body`, `not_found`).
        issues:
          type: array
          items:
            description: Any type
          description: Schema-validation issues, present when `error` is `invalid_body`.
      required:
        - error
      description: Standard API error response.
      title: ErrorResponse
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        WorkOS session JWT or an organization API key, sent as `Authorization:
        Bearer <token>`.

```

## Examples



**Request**

```json
{
  "kind": "google-service-account",
  "label": "Marketing Team GCP Storage"
}
```

**Response**

```json
{
  "credential": {
    "_id": "cred_9f8b7c6d5e4a3b2c1d0e",
    "kind": "google-service-account",
    "label": "Marketing Team GCP Storage",
    "createdAt": "2024-06-10T09:15:00Z",
    "createdBy": "user_12345"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api/storage/credentials"

payload = {
    "kind": "google-service-account",
    "label": "Marketing Team GCP Storage"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api/storage/credentials';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"kind":"google-service-account","label":"Marketing Team GCP Storage"}'
};

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/storage/credentials"

	payload := strings.NewReader("{\n  \"kind\": \"google-service-account\",\n  \"label\": \"Marketing Team GCP Storage\"\n}")

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

	req.Header.Add("Authorization", "Bearer <token>")
	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/storage/credentials")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"kind\": \"google-service-account\",\n  \"label\": \"Marketing Team GCP Storage\"\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/storage/credentials")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"kind\": \"google-service-account\",\n  \"label\": \"Marketing Team GCP Storage\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api/storage/credentials', [
  'body' => '{
  "kind": "google-service-account",
  "label": "Marketing Team GCP Storage"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api/storage/credentials");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"kind\": \"google-service-account\",\n  \"label\": \"Marketing Team GCP Storage\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "kind": "google-service-account",
  "label": "Marketing Team GCP Storage"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api/storage/credentials")! 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()
```