# API for creating solid pods

**URL:** <https://forum.solidproject.org/t/api-for-creating-solid-pods/1933>\
**Category:** General Discussion\
**Created:** [June 24, 2019, 11:55am UTC](https://forum.solidproject.org/t/api-for-creating-solid-pods/1933 "2019-06-24T11:55:33Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![A\_A](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/a_a/32/786_2.png) [@A\_A](https://forum.solidproject.org/u/A_A)\
**Post date:** [January 31, 2024, 8:47am UTC](https://forum.solidproject.org/t/api-for-creating-solid-pods/1933/15 "2024-01-31T08:47:42Z")

</div>

This sounds like your `authorizationValue` is not properly set.

Here’s the complete script that created [https://secure.agefix.space/testomate/](https://secure.agefix.space/testomate/)

You can save it as someScript.js locally and execute with `node someScript.js`

```javascript
// baseUrl = 'http://localhost:3000'
baseUrl = 'https://secure.agefix.space'
indexUrl = baseUrl + '/.account/'

async function main() {
// get available endpoints
res = await fetch(indexUrl)
data = await res.json()
controls = data.controls

// create an account (requires no parameters)
res = await fetch(controls.account.create, { method: 'POST' }) 
data = await res.json()
authorizationValue = data.authorization

// get available endpoints, but now for the fresh account (should also work via the cookie, authorization header is probably not necessary)
res = await fetch(indexUrl, { headers: { authorization: `CSS-Account-Token ${authorizationValue}` } })
data = await res.json()
controls = data.controls

// setup a login via email+password for the current account
res = await fetch(controls.password.create, {
  headers: {
    authorization: `CSS-Account-Token ${authorizationValue}`,
    'content-type': 'application/json'
  },
  method: 'POST',
  body: JSON.stringify({
    email: 'test@example.org',
    password: 'secret-12345',
  }),
})
data = await res.json()

// now we can login with email+password
res = await fetch(controls.password.login, {
  headers: {
    'content-type': 'application/json'
  },
  method: 'POST',
  body: JSON.stringify({
    email: 'test@example.org',
    password: 'secret-12345',
  }),
})
data = await res.json()
authorizationValue = data.authorization

// get available endpoints for current account
res = await fetch(indexUrl, { headers: { authorization: `CSS-Account-Token ${authorizationValue}` } })
data = await res.json()
controls = data.controls
console.log(controls.account.pod)

// setup a pod
res = await fetch(controls.account.pod, {
  headers: {
    authorization: `CSS-Account-Token ${authorizationValue}`,
    'content-type': 'application/json'
  },
  method: 'POST',
  body: JSON.stringify({
    name: 'testomate',
  }),
})
data = await res.json()

console.log(`Created pod: ${JSON.stringify(data, undefined, 2)}`)
}

main()

```

---

_[View the full topic](https://forum.solidproject.org/t/api-for-creating-solid-pods/1933)._
